https://issues.dlang.org/show_bug.cgi?id=19169

Walter Bright <bugzi...@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Walter Bright <bugzi...@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.

--

Reply via email to