www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 1669] New: this.outer in nested classes gives a bogus pointer

reply d-bugmail puremagic.com writes:
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 users.sf.net
        ReportedBy: jarrett.billingsley 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.


-- 
Nov 14 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1669


csantander619 gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Linux                       |All
           Platform|PC                          |All





Happens on Mac OS X too.


-- 
Nov 14 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1669


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



Fixed in hg commit 227 / release 0.25.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 29 2010