Manifest constant class instances

lngns contact at lngnslnvsk.net
Sun Nov 4 19:02:33 UTC 2018


Trying to store a class instance in an enum yields `Unable to 
initialize enum with class or pointer to struct. Use static const 
variable instead.`

Given the compiler can access static constants at compile-time 
too, what are the reasons for not allowing `enum E = new T;`?
I can understand for pointers to struct, as the pointer will be 
invalid at runtime, but, unless I am mistaken, classes are not 
concerned by pointer semantics.


More information about the Digitalmars-d mailing list