[Issue 17932] New: [scope] __traits(compiles, stmt) cannot test scope violations
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 23 20:12:41 UTC 2017
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: bugzilla at digitalmars.com
Reporter: code at 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;
}
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
--
More information about the Digitalmars-d-bugs
mailing list