]>
Commit | Line | Data |
---|---|---|
b4c522fa IB |
1 | /* |
2 | TEST_OUTPUT: | |
3 | --- | |
5fee5ec3 IB |
4 | fail_compilation/fail177.d(22): Error: cannot modify `immutable` expression `j` |
5 | fail_compilation/fail177.d(24): Error: cannot modify `const` expression `i` | |
6 | fail_compilation/fail177.d(26): Error: cannot modify `const` expression `s1.x` | |
7 | fail_compilation/fail177.d(27): Error: cannot modify `const` expression `*s1.p` | |
8 | fail_compilation/fail177.d(29): Error: cannot modify `const` expression `s2.x` | |
9 | fail_compilation/fail177.d(30): Error: cannot modify `const` expression `*s2.p` | |
b4c522fa IB |
10 | --- |
11 | */ | |
12 | ||
13 | struct S | |
14 | { | |
15 | int x; | |
16 | int* p; | |
17 | } | |
18 | ||
19 | void test(const(S) s1, const S s2, const(int) i) | |
20 | { | |
21 | immutable int j = 3; | |
22 | j = 4; | |
23 | ||
24 | i = 4; | |
25 | ||
26 | s1.x = 3; | |
27 | *s1.p = 4; | |
28 | ||
29 | s2.x = 3; | |
30 | *s2.p = 4; | |
31 | } |