[Issue 5350] New: .tupleof lists members of nested anonymous union as members of containing struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 14 07:56:07 PST 2010


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

           Summary: .tupleof lists members of nested anonymous union as
                    members of containing struct
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: elfy.nv at gmail.com


--- Comment #0 from Nick Voronin <elfy.nv at gmail.com> 2010-12-14 07:54:21 PST ---
struct S2
{
    int type;
    union {
        int i;
        string s;
    }
}
void main()
{
    S2 s2;
    foreach (i, Subobj; typeof(s2.tupleof))
    {
    writeln(s2.tupleof[i].stringof);
    }
}

output:
---
s2.type
s2.i
s2.s
---

This in turn leads to wrong behaviour of std.exception.pointsTo, which tries
every member of union (read: all kind of invalid pointers) without any clue
that they are actually part of nested union.

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


More information about the Digitalmars-d-bugs mailing list