Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/fail24485.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=24485
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail24485.d(25): Error: cannot implicitly convert expression `*a` of type `A` to `B`
6 fail_compilation/fail24485.d(31): Error: cannot implicitly convert expression `this.a` of type `A` to `B`
7
8 ---
9 */
10
11 struct A
12 {
13 int i = 43;
14 this(ref A rhs) {}
15 }
16
17 struct B
18 {
19 int i = 42;
20 }
21
22 ref B foo()
23 {
24 auto a = new A;
25 return *a;
26 }
27
28 struct C
29 {
30 A a;
31 @property ref B b() { return a; }
32 }