www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



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

↑ ↓ ← 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
↑ ↓ → 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




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


-- 
Nov 14 2007