www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23827] New: IsExpression allows Identifier outside static

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

          Issue ID: 23827
           Summary: IsExpression allows Identifier outside static
                    if/assert
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: nick geany.org

All 4 forms below should error:

void main()
{
    enum e = is(int Int);
    assert(is(int Int1 == const));

    if (is(int Int2)) {} // only this is caught
    auto x = is(int Int3 : float);
}

isexpident.d(14): Error: can only declare type aliases within `static if`
conditionals or `static assert`s

PR incoming.

--
Apr 05 2023