[Issue 8300] New: Stack overflow with alias this

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 26 00:47:41 PDT 2012


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 at puremagic.com
        ReportedBy: rswhite4 at googlemail.com


--- Comment #0 from rswhite4 at googlemail.com 2012-06-26 00:50:10 PDT ---
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: -------


More information about the Digitalmars-d-bugs mailing list