Escape this in pure members
Per Nordlöw
per.nordlow at gmail.com
Wed Sep 23 14:39:43 UTC 2020
On Wednesday, 23 September 2020 at 00:06:38 UTC, DlangUser38
wrote:
>> Hmm, why would `b` have longer lifetime? Isn't the lifetime of
>> `b` throughout `bar`?
>
> The following analysis might be wrong but I think that `scope`
> as a **member** function attribute is not supposed to be used
> as that is not even documented.
Where's the other scope analysis documented?
> So it would works "by default". The compiler thinks that `this`
> is a scope variable that will stop living after `bar()`.
So are you saying that this code should compile with and without
the member being `scope`?
> Also as `b` is not `ref` this is clearly a wrong diagnostic.
> There's a special case missing in the compiler.
More information about the Digitalmars-d-learn
mailing list