A public domain game written in D

SimonN via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 4 05:16:55 PST 2017


On Saturday, 4 February 2017 at 08:50:42 UTC, Stefan Koch wrote:
> you need to make enums into static immmutable.
>
> If you ever worked for you when using enums you were living 
> dangerously.

I've pushed a fix by moved the code to runtime, the static 
asserts to unittested asserts. Thanks for your hint still; will 
keep in mind for the future.

The problematic code was like this:

     class A { /* ... */ }
     struct B { A a; /* ... */ }

     enum B errorsNowDuringCTFE = /* ... */;

I wrote this over a year ago, trying to find out just how much 
can be forced into CTFE. The compiler accepted it, and yeah, it 
worked cross-platform. I imagined that 'enum' and 'static 
immutable' were equivalent, even though that looked like a 
stretch.

Keep up the good, aggressive compiler development that finds such 
latent bugs!

-- Simon


More information about the Digitalmars-d mailing list