d: Merge upstream dmd 568496d5b, druntime 178c44ff, phobos 574bf883b.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / testAliasLookup.d
blob786c2f43dbb3986e9c51f2138dd7619eb86d6b06
1 // REQUIRED_ARGS: -preview=fixAliasThis
3 // https://issues.dlang.org/show_bug.cgi?id=16086
4 struct A
6 void tail() {}
9 struct S16086
11 struct Inner2
13 Inner a;
14 alias a this;
17 struct Inner
19 int unique_identifier_name;
20 int tail = 2;
23 Inner2 inner;
24 alias inner this;
26 auto works()
28 return unique_identifier_name;
31 auto fails()
33 int a = tail;
34 return tail; // Line 22
35 // The workaround: return this.tail;
39 // https://issues.dlang.org/show_bug.cgi?id=16082
40 struct S16082
42 struct Inner
44 int any_name_but_modulename;
45 int aliasthis = 5;
48 Inner inner;
49 alias inner this;
51 auto works()
53 return any_name_but_modulename;
55 auto fails()
57 return aliasthis; // Line 20