Bug 19685 – Nested aggregate overlaps not detected
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-02-18T21:53:41Z
Last change time
2019-02-24T18:25:54Z
Keywords
pull
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0 by bugzilla — 2019-02-18T21:53:41Z
Regression introduced by https://github.com/dlang/dmd/pull/9288
kinke writes:
some overlapping fields in the following example apparently don't get their `VarDeclaration.overlapped` flag set:
struct SWithUnion
{
char c;
S nested;
union
{
struct { ubyte ub = 6; ushort us = 33; align(8) ulong ul_dummy = void; ulong last = 123; }
struct { uint ui1; uint ui2 = 84; ulong ul = 666; }
}
}
Comment #1 by kinke — 2019-02-18T23:30:57Z
https://run.dlang.io/is/p9cpXq:
```
struct S
{
union
{
struct { int a = 123; }
struct { int b = 456; }
}
}
void main()
{
S s;
assert(s.b == 123);
}
```
Compiles successfully with 2.085.0-beta1, earlier versions rightfully complain:
Error: overlapping default initialization for field b and a
Error: overlapping default initialization for field a and b
Comment #2 by dlang-bot — 2019-02-19T00:38:59Z
@Basile-z created dlang/dmd pull request #9373 "fix issue 19685 - Revert "aggregate, reduce the complexity of the loo…" fixing this issue:
- fix issue 19685 - Revert "aggregate, reduce the complexity of the loop checking the overlapped fields"
This reverts commit 2ada2803f40cb59e4528dfadcf824d24e269d1f5.
https://github.com/dlang/dmd/pull/9373
Comment #3 by dlang-bot — 2019-02-24T16:59:49Z
@MartinNowak created dlang/dmd pull request #9387 "Merge remote-tracking branch 'upstream/stable' into merge_stable" fixing this issue:
- Merge pull request #9373 from Basile-z/issue-19685
fix issue 19685 - Revert "aggregate, reduce the complexity of the loo…
merged-on-behalf-of: Nicholas Wilson <[email protected]>
https://github.com/dlang/dmd/pull/9387
Comment #4 by dlang-bot — 2019-02-24T18:25:54Z
dlang/dmd pull request #9387 "Merge remote-tracking branch 'upstream/stable' into merge_stable" was merged into master:
- 1ed87aae3546f4d71df1d9e2e85c93d29d07a2b0 by The Dlang Bot:
Merge pull request #9373 from Basile-z/issue-19685
fix issue 19685 - Revert "aggregate, reduce the complexity of the loo…
merged-on-behalf-of: Nicholas Wilson <[email protected]>
https://github.com/dlang/dmd/pull/9387