www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5637] New: Anonymous structs/unions should have their own context

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: ibuclaw ubuntu.com



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: -------
Feb 21 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5637


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX



Pathological case no longer shows up in gdc.  Closing old report.

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