digitalmars.D.bugs - [Issue 17049] New: [scope] class references are not escape checked
- via Digitalmars-d-bugs (36/36) Dec 31 2016 https://issues.dlang.org/show_bug.cgi?id=17049
https://issues.dlang.org/show_bug.cgi?id=17049 Issue ID: 17049 Summary: [scope] class references are not escape checked like pointers Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: code dawg.eu cat > bug.d << CODE version (all) // broken for class refs class P; else alias P = int*; // works for int pointers struct S { safe P get() return scope; } P escape() safe { S s; P p = s.get(); return p; } CODE ---- dmd -c -o- bug -transition=safe -de ---- Should fail to compile and report `scope variable p may not be returned`. Tested with v2.073.0-scope-e46873f (dmd-scope-2016-12-27 preview build). --
Dec 31 2016