Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail19099.d(26): Error: cannot modify struct instance `a` of type `A` because it contains `const` or `immutable` members
5 ---
6 */
7
8 struct B
9 {
10 this(this) {}
11 ~this() {}
12 int a;
13 }
14
15 struct A
16 {
17 B b;
18 immutable int a;
19 this(int b) { a = b;}
20 }
21
22 void main()
23 {
24 A a = A(2);
25 A b = A(3);
26 a = b;
27 }