Re: Error: 'this' is only defined in non-static member functions, not main

2015-07-29 Thread remi thebault via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 22:12:38 UTC, anonymous wrote: Slapping `static` on `get` seems to make it work: static size_t get() {return member.offsetof;} Good slap, thanks! you solved my problem I guess the compiler thinks that since `item.link` is an instance member, it ne

Re: Error: 'this' is only defined in non-static member functions, not main

2015-07-29 Thread anonymous via Digitalmars-d-learn
{ int link; } void main() { wl_container_of!(item.link).get(); /* Error: 'this' is only defined in non-static member functions, not main */ } I'm not sure what's going on here, if this should or shouldn't work. The error message isn't exactly good. Sla

Error: 'this' is only defined in non-static member functions, not main

2015-07-29 Thread remi thebault via Digitalmars-d-learn
Hello I have this weird error trying to achieve something simple: module list_test; // import wayland.util; template Id(alias a) { alias Id = a; } template ParentOf(alias member) { alias ParentOf = Id!(__traits(parent, member)); } template wl_container_of(alias member) { ParentOf