]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gdc.test/fail_compilation/fail177.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail177.d
CommitLineData
b4c522fa
IB
1/*
2TEST_OUTPUT:
3---
5fee5ec3
IB
4fail_compilation/fail177.d(22): Error: cannot modify `immutable` expression `j`
5fail_compilation/fail177.d(24): Error: cannot modify `const` expression `i`
6fail_compilation/fail177.d(26): Error: cannot modify `const` expression `s1.x`
7fail_compilation/fail177.d(27): Error: cannot modify `const` expression `*s1.p`
8fail_compilation/fail177.d(29): Error: cannot modify `const` expression `s2.x`
9fail_compilation/fail177.d(30): Error: cannot modify `const` expression `*s2.p`
b4c522fa
IB
10---
11*/
12
13struct S
14{
15 int x;
16 int* p;
17}
18
19void 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}