[Issue 24717] alias edge cases with tupleof

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 2 05:32:12 UTC 2024


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

--- Comment #14 from Max Samukha <maxsamukha at gmail.com> ---
(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).

--


More information about the Digitalmars-d-bugs mailing list