Debian Codegraph @

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

raw
1 // https://issues.dlang.org/show_bug.cgi?id=10886
2
3 struct A
4 {
5 @property int foo() { return 0; }
6 int bar() { return 0; }
7 }
8
9 struct B
10 {
11 void bar()
12 {
13 alias f = typeof(A.foo); // NG
14 alias b = typeof(A.bar); // ok
15 }
16 }
17
18 // https://issues.dlang.org/show_bug.cgi?id=21288
19
20 struct XA
21 {
22 int p;
23 }
24
25 struct XB
26 {
27 XA a() { return XA.init; }
28 alias a this;
29 }
30
31 struct XC
32 {
33 void foo()
34 {
35 static assert(XB.p.stringof == "p"); // Error: this for s needs to be type B not type C
36 }
37 }