digitalmars.D.bugs - [Issue 18128] New: [scope] escaping reference to class allocated on
- d-bugmail puremagic.com (30/30) Dec 25 2017 https://issues.dlang.org/show_bug.cgi?id=18128
https://issues.dlang.org/show_bug.cgi?id=18128 Issue ID: 18128 Summary: [scope] escaping reference to class allocated on the stack Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: bugzilla digitalmars.com class A { int i; } void inc(A a) safe { a.i += 1; // Line 6 } auto makeA() safe { // Line 9 import std.algorithm : move; scope a = new A(); // allocates object on the stack instead of the heap return move(a); // should give an error } void main() safe { auto a = makeA(); a.inc(); // Line 17 } --
Dec 25 2017