mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
32 lines
554 B
D
32 lines
554 B
D
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/fail172.d(25): Error: cannot modify `const` expression `c1.x`
|
|
fail_compilation/fail172.d(26): Error: cannot modify `const` expression `c2.x`
|
|
fail_compilation/fail172.d(30): Error: cannot modify `const` expression `s1.x`
|
|
fail_compilation/fail172.d(31): Error: cannot modify `const` expression `s2.x`
|
|
---
|
|
*/
|
|
|
|
class C
|
|
{
|
|
int x;
|
|
}
|
|
|
|
struct S
|
|
{
|
|
int x;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
const(C) c1 = new C();
|
|
const C c2 = new C();
|
|
c1.x = 3;
|
|
c2.x = 3;
|
|
|
|
const(S) s1;
|
|
const S s2;
|
|
s1.x = 3;
|
|
s2.x = 3;
|
|
}
|