December 02, 2011 [Issue 7047] New: alias error in struct only for dmd1 | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7047 Summary: alias error in struct only for dmd1 Product: D Version: D1 Platform: x86 OS/Version: Windows Status: NEW Severity: regression Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: changlon@gmail.com --- Comment #0 from changlon <changlon@gmail.com> 2011-12-01 23:51:08 PST --- 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*' -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 09, 2011 [Issue 7047] alias error in struct only for dmd1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to changlon | http://d.puremagic.com/issues/show_bug.cgi?id=7047 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug@yahoo.com.au Resolution| |INVALID Severity|regression |normal --- Comment #1 from Don <clugdbug@yahoo.com.au> 2011-12-09 01:53:08 PST --- 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation