September 18, 2004 Crash on static const struct instances | ||||
---|---|---|---|---|
| ||||
The following code crashes DMD 0.101 on Windows XP: ------------------- struct Foo { static const Foo JOHN; } void main() { Foo bar = Foo.JOHN; } ------------------- I was just converting some C++ code where static const values like this where used as default or special values that a struct/class could have. I suppose other solutions are possible, but not quite as elegant. void foo(Foo val = Foo.JOHN) { if (val is Foo.JOHN) { .. } else { ... } } Lars Ivar Igesund |
Copyright © 1999-2021 by the D Language Foundation