Bug 22118 – Const union causes false multiple-initialization error in constructor

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-07-12T01:08:47Z
Last change time
2021-08-18T12:28:04Z
Keywords
pull
Assigned to
No Owner
Creator
Paul Backus
Blocks
22117

Comments

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
Comment #3 by dlang-bot — 2021-07-14T09:52:09Z
@RazvanN7 created dlang/dmd pull request #12875 "Fix Issue 22118 - Const union causes false multiple-initialization error in constructor" fixing this issue: - Fix Issue 22118 - Const union causes false multiple-initialization error in constructor https://github.com/dlang/dmd/pull/12875
Comment #4 by dlang-bot — 2021-07-14T12:15:09Z
dlang/dmd pull request #12875 "Fix Issue 22118 - Const union causes false multiple-initialization error in constructor" was merged into stable: - eba1b66615a1ecf5876a6b07616edd1585ad52bf by RazvanN7: Fix Issue 22118 - Const union causes false multiple-initialization error in constructor https://github.com/dlang/dmd/pull/12875
Comment #5 by dlang-bot — 2021-07-19T17:25:57Z
dlang/dmd pull request #12893 "Revert "Fix Issue 22118 - Const union causes false multiple-initialization error in constructor (#12875)"" was merged into stable: - d6278f7deb0e9012d6abeee8f8774cf405cb23c2 by Iain Buclaw: Revert "Fix Issue 22118 - Const union causes false multiple-initialization error in constructor (#12875)" This reverts commit 601d6c4ab8eaf15497dcc19ba0e4293c2bfc727b. https://github.com/dlang/dmd/pull/12893
Comment #6 by snarwin+bugzilla — 2021-07-19T18:20:20Z
Reopening since the fix was reverted.
Comment #7 by dlang-bot — 2021-07-20T08:54:31Z
@MartinNowak created dlang/dmd pull request #12895 "merge stable" fixing this issue: - Fix Issue 22118 - Const union causes false multiple-initialization error in constructor (#12875) CI failure is unrelated. - Revert "Fix Issue 22118 - Const union causes false multiple-initialization error in constructor (#12875)" This reverts commit 601d6c4ab8eaf15497dcc19ba0e4293c2bfc727b. https://github.com/dlang/dmd/pull/12895
Comment #8 by dlang-bot — 2021-07-23T22:15:20Z
dlang/dmd pull request #12895 "merge stable" was merged into master: - 601d6c4ab8eaf15497dcc19ba0e4293c2bfc727b by Razvan Nitu: Fix Issue 22118 - Const union causes false multiple-initialization error in constructor (#12875) CI failure is unrelated. - 2e1f74d7842425bd4010cbe559c1812c5301dc2b by Iain Buclaw: Revert "Fix Issue 22118 - Const union causes false multiple-initialization error in constructor (#12875)" This reverts commit 601d6c4ab8eaf15497dcc19ba0e4293c2bfc727b. https://github.com/dlang/dmd/pull/12895
Comment #9 by dlang-bot — 2021-08-02T11:02:39Z
@ibuclaw created dlang/dmd pull request #12944 "Merge branch 'stable' into merge_master" fixing this issue: - Fix Issue 22118 - Const union causes false multiple-initialization error in constructor (#12875) CI failure is unrelated. - Revert "Fix Issue 22118 - Const union causes false multiple-initialization error in constructor (#12875)" This reverts commit 601d6c4ab8eaf15497dcc19ba0e4293c2bfc727b. https://github.com/dlang/dmd/pull/12944
Comment #10 by dlang-bot — 2021-08-02T11:34:20Z
@RazvanN7 created dlang/dmd pull request #12945 "Fix Issue 22118 - Const union causes false multiple-initialization error in constructor" fixing this issue: - Fix Issue 22118 - Const union causes false multiple-initialization error in constructor https://github.com/dlang/dmd/pull/12945
Comment #11 by dlang-bot — 2021-08-18T12:28:04Z
dlang/dmd pull request #12945 "Fix Issue 22118 - Const union causes false multiple-initialization error in constructor" was merged into master: - 03860930f09277623b81a29d3fba87f0df7d4597 by RazvanN7: Fix Issue 22118 - Const union causes false multiple-initialization error in constructor https://github.com/dlang/dmd/pull/12945