Debian Codegraph @

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

raw
1 // https://issues.dlang.org/show_bug.cgi?id=14343
2 /* TEST_OUTPUT:
3 ---
4 fail_compilation/fail14343.d(21): Error: cannot modify struct instance `s` of type `S14343b` because it contains `const` or `immutable` members
5 fail_compilation/fail14343.d(23): Error: cannot modify struct instance `s` of type `S14343b` because it contains `const` or `immutable` members
6 ---
7 */
8
9 struct S14343b
10 {
11 int i;
12 immutable(Object) o;
13
14 void opAddAssign(int j) { i += j; }
15 void opAssign(S14343b other) {}
16 }
17
18 void test14343()
19 {
20 S14343b s;
21 ++s;
22 assert(s.i == 1);
23 s++;
24 assert(s.i == 2);
25 }