digitalmars.D.bugs - [Issue 17388] New: [DIP1000] no escape analysis for auto return
- via Digitalmars-d-bugs (35/35) May 09 2017 https://issues.dlang.org/show_bug.cgi?id=17388
https://issues.dlang.org/show_bug.cgi?id=17388 Issue ID: 17388 Summary: [DIP1000] no escape analysis for auto return scope members Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: per.nordlow gmail.com A file named `test_scope.d` containing safe pure nothrow nogc: struct S { safe pure nothrow nogc inout(int)[] opSlice() inout return scope { return x[]; } int[4] x; } int[] f() { S s; return s[]; } compiled with -dip1000 correctly errors as test_scope.d(16,13): Error: escaping reference to local variable s but if return type of `opSlice` is changed to `auto` the compiler acccepts it which is wrong. --
May 09 2017