www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8300] New: Stack overflow with alias this

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8300

           Summary: Stack overflow with alias this
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: rswhite4 googlemail.com



If i don't comment out the lines here, the compiler will print "Stack overflow"
all the time.
I think that's a compiler bug.

[code]

struct Test(T) {
private:
    T _val;

public:
    /+
     disable
    this(typeof(null));
    +/

    /+
    this(int i) {

    }
    +/

    this(T obj) {

    }

     property
    inout(T) Get() inout {
        return this._val;
    }

    alias Get this;
}

mixin template TRef(T) {
private:
    Test!(T) _ref;

    void InitRef() {
        this._ref = Test!(T)(this);
    }

public:
     property
    inout(Test!(T)) Get() inout {
        return this._ref;
    }
}

class Foo {
public:
    mixin TRef!(Foo);

    this() {
        InitRef();
    }
    /+
    void echo() const pure nothrow {
        writeln("Foo");
    }
    +/
    alias Get this;
}

void main() {

}
[/code]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 26 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8300


Kenji Hara <k.hara.pg gmail.com> changed:

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



*** This issue has been marked as a duplicate of issue 8053 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 26 2012