mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
35 lines
443 B
D
35 lines
443 B
D
// https://issues.dlang.org/show_bug.cgi?id=22118
|
|
|
|
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/fail22118.d(33): Error: cannot modify `this.v.a` in `const` function
|
|
---
|
|
*/
|
|
|
|
struct NeedsInit
|
|
{
|
|
int n;
|
|
@disable this();
|
|
}
|
|
|
|
union U
|
|
{
|
|
NeedsInit a;
|
|
}
|
|
|
|
struct V
|
|
{
|
|
NeedsInit a;
|
|
}
|
|
|
|
struct S
|
|
{
|
|
U u;
|
|
V v;
|
|
this(const NeedsInit arg) const
|
|
{
|
|
u.a = arg; // this should compile
|
|
v.a = arg; // this should not
|
|
}
|
|
}
|