September 12, 2008 [Issue 2358] New: offsetof inconsistent between structs and classes | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2358 Summary: offsetof inconsistent between structs and classes Product: D Version: 1.035 Platform: PC OS/Version: Linux Status: NEW Keywords: rejects-valid, spec Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: kamm-removethis@incasoftware.de For classes .offsetof works only on the instance and for structs it only works on the declaration: -- class C { int x; } struct S { int x; } void main() { S s; C c = new C; auto c1 = c.x.offsetof; auto c2 = C.x.offsetof; // error auto s1 = s.x.offsetof; // error auto s2 = S.x.offsetof; } -- For classes, the situation is documented. For structs, the spec merely says that the offsetof property exists. I expect all combinations could me made legal. -- |
January 22, 2012 [Issue 2358] offsetof inconsistent between structs and classes | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2358 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |WORKSFORME --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2012-01-22 14:04:11 PST --- auto s1 = s.x.offsetof; // error works correctly now. The spec does document the current behavior. I hope to remove the restriction on the class .offsetof in the future. -- 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