enum and static if

Namespace via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 11 07:55:01 PDT 2015


On Wednesday, 11 March 2015 at 14:34:32 UTC, ketmar wrote:
> On Wed, 11 Mar 2015 13:48:45 +0000, Namespace wrote:
>
>> This code does not work:
>> 
>> ----
>> enum Test {
>>      Foo,
>> static if (__VERSION__ >= 2067)
>>      Bar,
>> }
>>      Quatz
>> }
>> ----
>> 
>> Any chance that this could work?
>
> nope. `static if` is statement, so it works only where 
> statement is
> allowed. the same is true for `version`. this is by design.

Thanks, I've hoped that 'static if' is a full replacement for #if


More information about the Digitalmars-d-learn mailing list