Thread overview |
---|
April 08, 2008 [Issue 1979] New: Anonymous class with confused context pointer | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1979 Summary: Anonymous class with confused context pointer Product: D Version: 1.028 Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: benoit@tionex.de The following snippet shows an inner anonymous class, that uses the constructor to copy local values to member var. This is to make a closure behaviour. When the inner class later tries to access the outer class, a segmentation fault happens. The compiler should either given an error or it should work. void main(){ auto o = new Outer; o.run(5); } interface Intf { void doIt(); } class Outer { int i; void inc( int v ){ i += v ; } void run( int v2 ){ auto i = new class Intf { int v2_; this(){ v2_ = v2; } void doIt(){ inc( v2_ ); // (1) segmentation fault } }; i.doIt(); } } -- |
April 18, 2009 [Issue 1979] Anonymous class with confused context pointer | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1979 ------- Comment #1 from clugdbug@yahoo.com.au 2009-04-18 03:43 ------- This doesn't segfault for me in DMD1.042. Has it been fixed? -- |
September 16, 2009 [Issue 1979] Anonymous class with confused context pointer | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1979 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug@yahoo.com.au Resolution| |FIXED --- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-09-16 02:39:16 PDT --- This was fixed in either 1.029 or 1.030. Works now. -- 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