dmd/compiler/test/fail_compilation/immutable_ctor.d
Nick Treleaven 5cf5959e9f Add test
Fix Issue 24247 - Improve constructor not callable using $modifier object error
2023-11-16 16:20:36 +00:00

19 lines
282 B
D

/*
TEST_OUTPUT:
---
fail_compilation/immutable_ctor.d(18): Error: `immutable` copy constructor `immutable_ctor.S1.this` cannot construct a mutable object
---
*/
struct S1
{
this(ref const S1 s) immutable {
}
int i;
}
void main()
{
const(S1) s1;
S1 ms1 = s1;
}