Thread overview
[Issue 1669] New: this.outer in nested classes gives a bogus pointer
Nov 14, 2007
d-bugmail
Nov 14, 2007
d-bugmail
Aug 29, 2010
Iain Buclaw
November 14, 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@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.


-- 

November 14, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1669


csantander619@gmail.com changed:

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




------- Comment #1 from csantander619@gmail.com  2007-11-14 16:57 -------
Happens on Mac OS X too.


-- 

August 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=1669


Iain Buclaw <ibuclaw@ubuntu.com> changed:

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


--- Comment #2 from Iain Buclaw <ibuclaw@ubuntu.com> 2010-08-29 09:01:05 PDT ---
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: -------