[Issue 9490] 'this' is not found when array expression is in parentheses

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 30 07:21:02 UTC 2019


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

--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
Funnily this works:

---
class C
{
    int[] arr;

    this()
    {
        auto a = ((arr)).length;
    }
}

void main()
{
}
---

The bug is not related to arrays or ctors. Same problem if you try to access
the member of a member:

class C
{
    struct Foo { int a; }
    Foo foo;

    void test()
    {
        // Error: need 'this' to access member a
        auto a =  (foo).a;
    }
}

void main()
{
}

--


More information about the Digitalmars-d-bugs mailing list