d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / diag8777.d
blob8dfac75bfcbc97632ab33123df604b8b6d11b5f5
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/diag8777.d(12): Error: constructor `diag8777.Foo1.this` missing initializer for immutable field `x`
5 fail_compilation/diag8777.d(12): Error: constructor `diag8777.Foo1.this` missing initializer for const field `y`
6 ---
7 */
8 class Foo1
10 immutable int[5] x;
11 const int[5] y;
12 this() {}
16 TEST_OUTPUT:
17 ---
18 fail_compilation/diag8777.d(25): Error: cannot modify `immutable` expression `x`
19 fail_compilation/diag8777.d(28): Error: cannot modify `const` expression `y`
20 ---
22 void test2()
24 immutable int x;
25 x = 1;
27 const int y;
28 y = 1;
32 TEST_OUTPUT:
33 ---
34 fail_compilation/diag8777.d(42): Error: cannot remove key from `immutable` associative array `hashx`
35 fail_compilation/diag8777.d(43): Error: cannot remove key from `const` associative array `hashy`
36 ---
38 immutable(int[int]) hashx;
39 const(int[int]) hashy;
40 void test3()
42 hashx.remove(1);
43 hashy.remove(1);