Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail11355.d(28): Error: struct `fail11355.A` is not copyable because it has a disabled postblit
5 ---
6 */
7
8 T move(T)(ref T source)
9 {
10 return T.init; // Dummy rvalue
11 }
12
13 struct A
14 {
15 ~this() {}
16 @disable this(this); // Prevent copying
17 }
18
19 struct B
20 {
21 A a;
22 alias a this;
23 }
24
25 void main()
26 {
27 B b;
28 A a = move(b);
29 }