http://d.puremagic.com/issues/show_bug.cgi?id=5637

           Summary: Anonymous structs/unions should have their own context
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: ibuc...@ubuntu.com


--- Comment #0 from Iain Buclaw <ibuc...@ubuntu.com> 2011-02-21 14:41:28 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to