[Issue 8111] New: [ICE] With templated recursive return-inferred function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 17 02:29:35 PDT 2012


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: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at 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: -------


More information about the Digitalmars-d-bugs mailing list