String switch is odd using betterC

Abby loniro7678 at twit-mail.com
Wed Feb 26 08:25:00 UTC 2020


I have a simple enum of strings like so:

enum Alphabet : string
{
     a = "A",
     b = "B",
     c = "C",
     d = "D",
     e = "E",
     f = "F",
     g = "G"
}

and then simple final switch like so:

extern(C) void main()
{
     auto s = Alphabet.f;
     final switch(s)
     {
         case Alphabet.a: break;
         case Alphabet.b: break;
         case Alphabet.c: break;
         case Alphabet.d: break;
         case Alphabet.e: break;
         case Alphabet.f: break;
         case Alphabet.g: break;
     }
}

The problem I have is that this causes:

/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(2999): 
Error: TypeInfo cannot be used with -betterC

Odd think is that wehen I remove g from my enum it compiles just 
fine, so it seems that this compilation error occurs only when my 
enum has more then 6 members.

Any idea why?


More information about the Digitalmars-d-learn mailing list