Bug 5637 – Anonymous structs/unions should have their own context

Status
RESOLVED
Resolution
WONTFIX
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-02-21T14:41:00Z
Last change time
2015-06-09T05:11:59Z
Assigned to
nobody
Creator
ibuclaw

Comments

Comment #0 by ibuclaw — 2011-02-21T14:41:28Z
This is kinda in the same league as bug1432, and I'm pretty certain fixing this will fix the other bug too. Basic example to show what I'm talking about: union A { double d; struct { uint hi; uint lo; } } Here, DMD reports that the union has 3 members, this is IMHO a bogus analysis. The union has 2 members, and one of them is an anonymous structure who is also the parent/context of the two fields (hi, lo) that it encases. This particular example also hurts GDC in some instances, as having a member of a *union* to whom's offset is > 0 confuses the backend. But there is currently no way/information available at the codegen stage to prevent this; except, perhaps looking ahead to scan the offset of all union members to see if the frontend is hiding a structure somewhere. This is less than ideal though, and would be better if there was anything to work with. Regards
Comment #1 by ibuclaw — 2012-09-07T02:20:49Z
Pathological case no longer shows up in gdc. Closing old report.