Comment #0 by snarwin+bugzilla — 2021-07-12T01:08:47Z
As of DMD 2.097.0, the following program fails to compile:
---
struct NeedsInit
{
int n;
@disable this();
}
union U
{
NeedsInit a;
}
struct S
{
U u;
this(const NeedsInit arg) const { u.a = arg; }
}
---
Compiler output, from run.dlang.io (with -vcolumns):
---
onlineapp.d(15,39): Error: const field `u` initialized multiple times
onlineapp.d(15,39): Previous initialization is here.
---
The error message is false: there is only a single initialization of `u`.
Related: issue 21229.
Comment #1 by moonlightsentinel — 2021-07-12T15:38:08Z
Regression from 2.081.2 according to run.dlang.io.
Comment #2 by moonlightsentinel — 2021-07-12T16:20:45Z