[Issue 2481] New: mixing field into anonymous struct inside class generates field overlapping vtable
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 30 11:11:30 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2481
Summary: mixing field into anonymous struct inside class
generates field overlapping vtable
Product: D
Version: 1.035
Platform: PC
OS/Version: Linux
Status: NEW
Keywords: wrong-code
Severity: major
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: tomas at famolsen.dk
template M() { int i; }
class Z { struct { mixin M!(); } }
void main() { Z z; writefln(z.i.offsetof); }
// output: 0
dmd uses offset=0 internally, meaning that if 'i' is written to, the vtable is
overwritten.
--
More information about the Digitalmars-d-bugs
mailing list