dmd/compiler/test/fail_compilation/fail19099.d
2022-07-09 18:53:07 +02:00

27 lines
353 B
D

/*
TEST_OUTPUT:
---
fail_compilation/fail19099.d(26): Error: cannot modify struct instance `a` of type `A` because it contains `const` or `immutable` members
---
*/
struct B
{
this(this) {}
~this() {}
int a;
}
struct A
{
B b;
immutable int a;
this(int b) { a = b;}
}
void main()
{
A a = A(2);
A b = A(3);
a = b;
}