[Issue 2358] New: offsetof inconsistent between structs and classes
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Sep 12 03:36:45 PDT 2008
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 at digitalmars.com
ReportedBy: kamm-removethis at 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.
--
More information about the Digitalmars-d-bugs
mailing list