https://issues.dlang.org/show_bug.cgi?id=17932
Issue ID: 17932
Summary: [scope] __traits(compiles, stmt) cannot test scope
violations
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: safe
Severity: normal
Priority: P3
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
cat > bug.d << CODE
void test() @safe
{
int var;
scope int* p;
static int* escape;
static assert(!__traits(compiles, { escape = p; }));
escape = p;
}
CODE
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
--