Bug 19680 – [REG2.085.0-beta.1] Uda inside union breaks default initialization

Status
RESOLVED
Resolution
WORKSFORME
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-02-16T16:09:38Z
Last change time
2020-03-21T03:56:38Z
Assigned to
No Owner
Creator
Juraj

Comments

Comment #0 by zero — 2019-02-16T16:09:38Z
Code: ---- struct MyInnerStruct { union { @("BRAKE_ME") int[2] v = 0; struct { int x, y; } } this(int vx, int vy) { x = vx; y = vy; } } struct MyStruct { MyInnerStruct inner = MyInnerStruct(1, 2); } void main() { { MyStruct ok = MyStruct(); assert(ok.inner.v == [1, 2]); } { MyStruct err; assert(err.inner.v == [1, 2]); } } --- run.dlang.io: https://run.dlang.io/is/fzj0IM
Comment #1 by zero — 2019-04-22T14:25:05Z
It seems to be fixed in dmd-2.085.0-beta.2 and later. As run.dlang.io does not contain beta versions, I can reproduce this bug only locally. I don't know if this issue should be closed, if there is no track of what change has fixed the problem.
Comment #2 by b2.temp — 2019-04-22T15:16:46Z
This is fixed and the regression has not been shipped. I think that the culprit was a PR supposed to simplify how something is made in intern but has been reverted.