http://d.puremagic.com/issues/show_bug.cgi?id=8111

           Summary: [ICE] With templated recursive return-inferred
                    function
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-05-17 02:30:57 PDT ---
Crashes DMD 2.060alpha:


class Foo(T) {
    Foo n;
}
auto bar(T)(Foo!T t) pure {
    return t ? bar(t.n) : [];
}
void main() {
    bar!int(null);
}


Replacing "auto" with "T[]" it compiles.

Maybe it's caused by a forward reference bug.


Removing "pure" it gives:

test.d(5): Error: forward reference to inferred return type of function call
bar(t.n)
test.d(8): Error: template instance test.bar!(int) error instantiating
test.d(8): Error: forward reference to bar

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

Reply via email to