Bug 979 – offsetof for classes does not work

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-02-17T22:52:00Z
Last change time
2014-02-16T15:23:09Z
Assigned to
bugzilla
Creator
benoit

Comments

Comment #0 by benoit — 2007-02-17T22:52:47Z
from: http://www.digitalmars.com/d/class.html the example class Foo { int x; } void test(Foo foo) { size_t o; o = Foo.x.offsetof; // yields 8 } t.d(12): Error: 'this' is only allowed in non-static member functions, not test t.d(12): Error: this for x needs to be type Foo not type int
Comment #1 by tomas — 2007-02-18T20:50:25Z
Hey Frank, don't you think that maybe in this one, severity could be marked as something higher than normal? Kind regards, -- Tom; [email protected] escribi
Comment #2 by benoit — 2007-02-19T13:14:30Z
> don't you think that maybe in this one, severity could be marked as > something higher than normal? Yes, i forgot about setting this.
Comment #3 by benoit — 2007-02-19T15:52:21Z
But note, this works: class Foo{ int x; static void foo(){ int o = x.offsetof; // works } }
Comment #4 by thomas-dloop — 2007-03-08T10:30:54Z
Comment #5 by thomas-dloop — 2007-04-27T12:31:01Z
Comment #6 by onlystupidspamhere — 2007-06-17T15:52:11Z
I'm marking this as a duplicate of #515. It's basically the same bug, but #515 is older and the description is a bit more precise. *** This bug has been marked as a duplicate of 515 ***