Static Initialization of Struct as UDA

jmh530 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 13 16:02:58 PDT 2017


On Tuesday, 13 June 2017 at 22:16:37 UTC, ag0aep6g wrote:
>
> No bug. `static` has no effect on module-level variables. `z` 
> is a normal mutable variable, not at all guaranteed to be 
> constant. Make it an `enum` or `immutable`.
>
> Note that immutable doesn't guarantee compile-time constancy, 
> either. You can only use an `immutable` as a compile-time 
> constant when it's statically initialized.

Appreciate the replies.


More information about the Digitalmars-d-learn mailing list