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

--- Comment #14 from Max Samukha <[email protected]> ---
(In reply to Manu from comment #13)
> Ah yes, good point. I also had an encounter with that exact surprise about 2
> days ago aswell.
> I couldn't work out how to explain that... I just had to shake me head and
> move on.

The same logic as that of alias - the reference is resolved to a contextless
symbol, and then the implicit 'this' is used as the context.

struct S
{
    int x;
    void foo()
    {
        alias y = S.x;
        auto z = y; // `z` is resolved to `this.x`;
    }
}

(Disclaimer: I'm not defending the "symbol" nonsense).

--

Reply via email to