Bug 21477 – TypeInfo errors in betterC are cryptic

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-12-13T04:14:55Z
Last change time
2023-01-03T13:27:21Z
Keywords
betterC, diagnostic, pull
Assigned to
No Owner
Creator
dave287091
See also
https://issues.dlang.org/show_bug.cgi?id=22579

Comments

Comment #0 by dave287091 — 2020-12-13T04:14:55Z
A minimal program, compiled with -betterC: extern(C) int main(){ int[] foo = [1]; return 0; } Yields the error message: bug.d(2): Error: TypeInfo cannot be used with -betterC It is correct to error, but the error is hard to understand. It would be much nicer nice if the error reported what it was trying to generate type info for (the usage that forces generation of type info can be very far from the declaration) and why TypeInfo was being generated in this case. Also, it is not clear to me that this is even the right error message. Why is it complaining about TypeInfo when the real issue is you can’t use runtime-managed dynamic arrays in betterC?
Comment #1 by dlang-bot — 2022-06-04T06:53:53Z
@WalterBright created dlang/dmd pull request #14181 "Fix Issue 21477 - TypeInfo errors in betterC are cryptic" fixing this issue: - Fix Issue 21477 - TypeInfo errors in betterC are cryptic https://github.com/dlang/dmd/pull/14181
Comment #2 by dlang-bot — 2022-06-05T10:19:35Z
dlang/dmd pull request #14181 "Fix Issue 21477 - TypeInfo errors in betterC are cryptic" was merged into master: - 9eb922ff7e5a04247be1b3b64cf3f414cc71e86f by Walter Bright: Fix Issue 21477 - TypeInfo errors in betterC are cryptic https://github.com/dlang/dmd/pull/14181
Comment #3 by dkorpel — 2023-01-03T13:27:21Z
*** Issue 22334 has been marked as a duplicate of this issue. ***