Debian Codegraph @

gcc/testsuite/gdc.test/compilable/b9490.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=9490
2 class A
3 {
4 int[1] arr;
5
6 this()
7 {
8 assert(arr.length);
9 assert((arr).length);
10 }
11 }
12
13 class C
14 {
15 struct Foo { int a; void funcToo(){} }
16 Foo foo;
17
18 auto get(){return foo;}
19
20 void test()
21 {
22 // Error: need 'this' to access member a
23 (foo).a = 1;
24 (foo).funcToo();
25 (get()).a = 2;
26 }
27 }
28
29 struct S { int i; }
30 struct S1 { S s; }
31 void f(int) { }
32
33 void main()
34 {
35 S1 s1;
36 f(s1.s.tupleof); // OK
37 f((s1.s).tupleof); // Error: need 'this' to access member s
38 }