digitalmars.D.bugs - [Issue 4256] New: Inner template mathods can't access this pointer
- d-bugmail puremagic.com (26/26) May 31 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4256
- d-bugmail puremagic.com (47/47) Sep 16 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4256
- d-bugmail puremagic.com (9/9) May 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4256
http://d.puremagic.com/issues/show_bug.cgi?id=4256 Summary: Inner template mathods can't access this pointer Product: D Version: unspecified Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: simen.kjaras gmail.com PDT --- struct bar { int n; void baz( ) { void qux(T)() { n = 3; } qux!int(); } } The above code barfs on 'n = 3;': "Error: need 'this' to access member n". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 31 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4256 Simen Kjaeraas <simen.kjaras gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code PDT --- This bug has grown worse. A lot worse. Good news: this now compiles: struct foo { int n; void baz( ) { void qux(T)() { n = 3; assert(n == 3); // Passes } qux!int(); } } void main( ) { foo b; assert(b.n == 0); // Passes b.baz(); assert(b.n == 3); // Fails } As we can see, the change in n is not properly propagated. What's even worse, is this: struct foo { int n; void baz( ) { void qux(T)(void* a) { // Added parameter n = 3; assert(n == 3); // Passes assert(a == &this); // Added. } qux!int(&this); } } void main( ) { foo b; assert(b.n == 0); // Passes b.baz(); assert(b.n == 3); // No longer fails. } You can then remove the assert on line 7 (a == &this) to get the old behavior back, the additional parameter changes nothing on its own. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 16 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4256 Simen Kjaeraas <simen.kjaras gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 13 2012