[Issue 19169] [betterC] bogus TypeInfo error for `enum string[] a = ["a"]; auto aa = a;`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jan 15 04:30:57 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=19169
Walter Bright <bugzilla at digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to Nicholas Wilson from comment #0)
> extern(C) void main() {
> enum string[] a = ["a"];
> auto aa = a; // line 3
> }
Now produces the error:
test.d(3): Error: expression `["a"]` uses the GC and cannot be used with switch
`-betterC`
which is not bad. If we write this:
extern(C) void main() {
enum string[] a = ["a"];
auto aa = a[0];
}
it compiles without complaint. As far as I can see, this is expected behavior.
The former produces the error because ["a"] has to be allocated somewhere at
runtime, but with no GC, where should it be placed?
> At the very least the error message should not suck.
This condition is met, so I shall mark this as fixed.
--
More information about the Digitalmars-d-bugs
mailing list