www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8111] New: [ICE] With templated recursive return-inferred function

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
May 17 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8111


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com



No ice with 2.062

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 16 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8111


bearophile_hugs eml.cc changed:

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



Now it gives:

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

Closed.

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