On Monday, 14 October 2019 at 17:00:56 UTC, John Colvin wrote:
Different ability to access a property depending if I'm inside something else when I look?

[snip]

You're attempting to call one of S's member functions without an instance of S to call it on. Reduced version:

struct S
{
    int a;
    int e() @property { return a; }
}

void foo(S s)
{
pragma(msg, __LINE__, " ", __traits(compiles, S.e)); // true (???)
    S.e; // Error: need `this` for `e` of type `@property int()`
}

struct C
{
    void foo(S s)
    {
pragma(msg, __LINE__, " ", __traits(compiles, S.e)); // false S.e; // Error: `this` for `e` needs to be type `S` not type `C`
    }
}

The real issue here is that the first `__traits(compiles)` check succeeds, even though the actual expression fails.

Reply via email to