dmd 1.071 error . struct Test1 { alias typeof(this) This; alias This* pThis; int number ; void Init(){ static void Callback (void* user_data){ pThis _this = cast(pThis) user_data; auto i = _this.number ; } } } ------------ test.d(10): Error: no property 'number' for type 'Test1*'
This isn't a regression. It gave exactly the same error back in DMD 1.000. In fact, it's not even a bug: in D1, 'this' for a struct is a pointer to that struct. As you can see with this code: struct Test1 { static assert(is(typeof(this) == Test1)); // FAILS !!! } In D2, the 'this' pointer is the struct itself. If you make this change: - alias This* pThis; + alias This pThis; your code will compile.