Comment #0 by matti.niemenmaa+dbugzilla — 2006-11-15T07:01:59Z
The spec has code amounting to the following, under "Field Properties":
class Foo {
int x;
}
void main() {
Foo foo = new Foo();
size_t o;
o = Foo.x.offsetof;
o = foo.x.offsetof;
}
The spec states that the above of the two assignments to o should yield 8 and the below should fail to compile. DMD's behaviour is precisely the opposite. The explanation confused me somewhere around "fields qualified with the type of the class" so I'm not sure which is right, but one of the two - the spec, or DMD - has to be wrong.
Comment #1 by smjg — 2006-12-11T20:23:27Z
The spec makes more sense than what the compiler is doing. I'm therefore inclined that DMD is wrong.
Comment #2 by onlystupidspamhere — 2007-06-17T15:52:11Z
*** Bug 979 has been marked as a duplicate of this bug. ***
Comment #3 by onlystupidspamhere — 2007-06-17T15:54:49Z
*** Bug 2202 has been marked as a duplicate of this bug. ***
Comment #6 by wbaxter — 2008-07-09T06:44:45Z
There's a typo in the updated doc now:
".offsetof can only be applied to not expressions"
I'll file a different bug though. This basic issue of this bug has been fixed by changing the spec.