www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17932] New: [scope] __traits(compiles, stmt) cannot test


          Issue ID: 17932
           Summary: [scope] __traits(compiles, stmt) cannot test scope
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: safe
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: bugzilla digitalmars.com
          Reporter: code dawg.eu

cat > bug.d << CODE
void test()  safe
    int var;
    scope int* p;
    static int* escape;
    static assert(!__traits(compiles, { escape = p; }));
    escape = p;
dmd -c -dip1000 bug.d
bug.d(6): Error: static assert  !true is false

The static assertion should pass as the assignment is not allowed.

bug.d(7): Error: scope variable p assigned to non-scope escape

Oct 23 2017