December 14, 2010 [Issue 5350] New: .tupleof lists members of nested anonymous union as members of containing struct | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: elfy.nv@gmail.com --- Comment #0 from Nick Voronin <elfy.nv@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: ------- |
December 20, 2010 [Issue 5350] .tupleof lists members of nested anonymous union as members of containing struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Voronin | http://d.puremagic.com/issues/show_bug.cgi?id=5350 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |INVALID --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2010-12-19 22:01:03 PST --- All anonymous unions do is control the layout. The fields *are* part of the enclosing struct's fields. This is as designed. Not a bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation