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. ***