digitalmars.D.bugs - [Issue 11208] New: returned ref to scoped isn't caught by local ref escape error
- d-bugmail puremagic.com (37/37) Oct 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11208
http://d.puremagic.com/issues/show_bug.cgi?id=11208 Summary: returned ref to scoped isn't caught by local ref escape error Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: eco gnuk.net Tested with dmd 2.63.2. Trying to return a ref int to a local int errors correctly as does a `scope A a = new A()`. --- import std.typecons, std.stdio; class A { } // Using auto ref because I don't know how to get the type of scoped // (I guess I should file this behavior as a bug too) auto ref fun() { auto a = scoped!A(); writefln("%x", &a); return a; // Compiler should output: // Error: escaping reference to scope local a } void main() { auto a = fun(); writefln("%x", &a); } --- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 09 2013