Thread overview
[Issue 9490] 'this' is not found when array expression is in parentheses
Apr 30
Basile-z
Apr 30
Basile-z
Jul 23
Basile-z
[Issue 9490] 'this' is not found when expression is in parentheses
Jul 23
Basile-z
Jul 23
Basile-z
April 30
https://issues.dlang.org/show_bug.cgi?id=9490

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

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

--- Comment #2 from Basile-z <b2.temp@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()
{
}

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

--- Comment #3 from Basile-z <b2.temp@gmx.com> ---
3rd test case from 9185:

---
struct S { int i; }
struct S1 { S s; }
void f(int) { }

void main()
{
    S1 s1;
    f(s1.s.tupleof); // OK
    f((s1.s).tupleof); // Error: need 'this' to access member s
}
---

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

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|'this' is not found when    |'this' is not found when
                   |array expression is in      |expression is in
                   |parentheses                 |parentheses

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

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg@gmail.com

--- Comment #4 from Basile-z <b2.temp@gmx.com> ---
*** Issue 9815 has been marked as a duplicate of this issue. ***

--