https://issues.dlang.org/show_bug.cgi?id=15996

--- Comment #4 from Walter Bright <[email protected]> ---
(In reply to Walter Bright from comment #3)
> The attachment:
> ---------------------------
> 
> safe:
> 
> import std.stdio;
> 
> struct T { int y; }
> 
> auto foo() {
>     auto t = T(12345);
>     auto x = &t.y;
>     return x;              // line 10
> }
> 
> unittest {
>     auto x = foo();
>     writeln("Hello world");
>     assert(*x == 12345);
> }

With:

    https://github.com/dlang/dmd/pull/5972

now yields:

    test3.d(10): Error: scope variable x may not be returned

so this is resolved once 5972 is pulled.

--

Reply via email to