[Issue 1669] New: this.outer in nested classes gives a bogus pointer
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 14 13:03:53 PST 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1669
Summary: this.outer in nested classes gives a bogus pointer
Product: DGCC aka GDC
Version: 0.24
Platform: PC
OS/Version: Linux
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P2
Component: glue layer
AssignedTo: dvdfrdmn at users.sf.net
ReportedBy: jarrett.billingsley at gmail.com
Have some code:
module foo;
import tango.io.Stdout;
abstract class Base
{
void foo();
}
class A
{
void print()
{
Stdout.formatln("I'm A!");
}
Base getBase()
{
return new class Base
{
override void foo()
{
this.outer.print();
}
};
}
}
void main()
{
auto a = new A();
auto b = a.getBase();
b.foo();
}
This causes a segmentation fault. If you inspect this.outer, it's completely
bogus -- this.outer.classinfo is filled with garbage, etc. This same code
works fine when compiled with DMD on Linux.
--
More information about the D.gnu
mailing list