Pointer to C++ member possible?

Bill Baxter dnewsgroup at billbaxter.com
Sun Mar 9 14:06:53 PDT 2008


Bill Baxter wrote:
> 
> However, .offsetof seems broken at the moment.  This example for the 
> docs doesn't compile for me:
> 
> class Foo
> {
>     int x;
> }
> ...
> void test(Foo foo)
> {
>     size_t o;
> 
>     o = Foo.x.offsetof;   // yields 8
> }
> 
> With dmd 1.028 I get:
> 
> ptrmemfun.d(29): Error: 'this' is only allowed in non-static member 
> functions, not test
> ptrmemfun.d(29): Error: this for value needs to be type Foo not type int

Looks like I'm not the first to notice:
http://d.puremagic.com/issues/show_bug.cgi?id=515

--bb


More information about the Digitalmars-d-learn mailing list