Delegate is left with a destroyed stack object

Jacob Carlborg doob at me.com
Wed Oct 30 00:49:48 PDT 2013


On 2013-10-29 22:57, Ali Çehreli wrote:

> Imagine someone decides to return a lambda from foo() instead:
>
> auto foo()
> {
>      S s = S(1);
>      return {};    // <-- Should 's' be immortal now?
> }
>
> Too subtle for my taste! :)

Of course not. "s" is never referred to in the returned delegate.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list