Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/diag12777.d(14): Error: cannot modify `this.v` in `const` function
5 fail_compilation/diag12777.d(15): Error: cannot modify `this.v` in `immutable` function
6 fail_compilation/diag12777.d(21): Error: cannot modify `this.v` in `const` function
7 fail_compilation/diag12777.d(22): Error: cannot modify `this.v` in `immutable` function
8 ---
9 */
10
11 struct S
12 {
13 int v;
14 void fun() const { v++; }
15 void gun() immutable { v++; }
16 }
17
18 class C
19 {
20 int v;
21 void fun() const { v++; }
22 void gun() immutable { v++; }
23 }