On 5/28/2014 6:06 PM, Brian Schott wrote:
On Thursday, 29 May 2014 at 00:58:35 UTC, Walter Bright wrote:
Off the top of my head:

    static if (condition)
    else :

    ... declarations ...

All attributes apply to either:

1. the next statement or declaration
2. { ... }
3. : ...

That case is (3), as static if is set up as an attribute.

Static if is not an attribute.

They are handled that way by the parser.

https://github.com/D-Programming-Language/dmd/blob/master/src/parse.c#L379

Looks like there's an omission in the grammar. Thanks for pointing it out.

https://issues.dlang.org/show_bug.cgi?id=12818




ConditionalStatement:
     Condition NoScopeNonEmptyStatement
     Condition NoScopeNonEmptyStatement else NoScopeNonEmptyStatement

Condition:
     VersionCondition
     DebugCondition
     StaticIfCondition

Attribute:
     LinkageAttribute
     AlignAttribute
     DeprecatedAttribute
     ProtectionAttribute
     Pragma
     static
     extern
     abstract
     final
     override
     synchronized
     auto
     scope
     const
     immutable
     inout
     shared
     __gshared
     Property
     nothrow
     pure
     ref

Reply via email to