constant expression

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 22 21:52:19 PST 2016


How is this not a constant expression ?
auto ctodtypes =
[
     "void"      : "void",
     "uint32_t"  : "uint",
     "uint64_t"  : "ulong",
     "int32_t"   : "int",
     "int64_t"   : "long",
     "char"      : "char",
     "uint8_t"   : "ubyte",
     "size_t"    : "size_t",
     "float"     : "float"
];
dmd complains
source/emit/registryemitter.d(7): Error: non-constant expression 
["void":"void", "uint32_t":"uint", "uint64_t":"ulong", 
"int32_t":"int", "int64_t":"long", "char":"char", 
"uint8_t":"ubyte", "size_t":"size_t", "float":"float"]


More information about the Digitalmars-d-learn mailing list