digitalmars.D.bugs - [Issue 23638] New: [betterC] Better Error Message For Runtime Usage
- d-bugmail puremagic.com (37/37) Jan 16 2023 https://issues.dlang.org/show_bug.cgi?id=23638
https://issues.dlang.org/show_bug.cgi?id=23638 Issue ID: 23638 Summary: [betterC] Better Error Message For Runtime Usage Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: jack jackstouffer.com Consider extern (C) int main () { auto s = "a".idup; return 0; } This gives the following src/druntime/import/object.d(3822): Error: `TypeInfo` cannot be used with -betterC This is a trivial example, but when the library is 30 kloc it's a bit harder to track down the offending code from this message. Especially since it doesn't even tell you which runtime function is the problem. I think the easiest thing to do would be to just add a stack trace like the ones in the error messages for bad template instantiations. Something like src/druntime/import/object.d(3822): Error: `TypeInfo` cannot be used with -betterC Instantiated from here: main.d(3) It would be nice to have but not necessary to say the name of the runtime function that's attempted to be used. src/druntime/import/object.d(3822): Error: `TypeInfo` cannot be used with -betterC In function dup defined on object.d(3820) Instantiated from here: main.d(3) --
Jan 16 2023