Bug 17725 – [scope] escape from nested function to enclosing local
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-08-06T22:37:05Z
Last change time
2017-10-16T09:57:38Z
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0 by bugzilla — 2017-08-06T22:37:05Z
From Rainer:
void test() @safe {
int* p;
struct T {
int a;
}
void escape(ref T t) @safe {
p = &t.a; // should not compile
}
{
T t;
escape(t);
}
auto bug = *p;
}
Compile with -dip1000