www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8961] New: IFTI fails with templates in specialization

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

           Summary: IFTI fails with templates in specialization
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com



10:07:28 MSK ---
---
template Int(T)
{ alias int Int; }

void f1(T)(T t, Int!T[] arr) { }
void f2(T, U = Int!T)(T t, U[] arr) { }
void f3(T, U : Int!T)(T t, U[] arr) { }
void f4(T, U : V, V = Int!T)(T t, U[] arr) { }
void f5(T, U = Int!T)(T t, U[] arr) if(is(U == Int!T)) { }

void main()
{
    int i;
    int[] arr;
    f1!int(i, arr);
    f1(i, arr);     // error, line 15
    f1(i, []);
    f1(i, null);

    f2!int(i, arr);
    f2(i, arr);
    f2(i, []);
    f2(i, null);

    f3!int(i, arr); // error, line 24
    f3(i, arr);     // error, line 25
    f3(i, []);      // error, line 26
    f3(i, null);    // error, line 27

    f4!int(i, arr);
    f4(i, arr);
    f4(i, []);
    f4(i, null);    // error, line 32

    f5!int(i, arr);
    f5(i, arr);
    f5(i, []);      // error, line 36
    f5(i, null);
}
---

Output:
---
main.d(15): Error: template main.f1 does not match any function template
declaration
main.d(15): Error: template main.f1(T) cannot deduce template function from
argument types !()(int,int[])
main.d(24): Error: template main.f3 does not match any function template
declaration
main.d(24): Error: template main.f3(T,U : Int!(T)) cannot deduce template
function from argument types !(int)(int,int[])
main.d(24): Error: template instance f3!(int) errors instantiating template
main.d(25): Error: template main.f3 does not match any function template
declaration
main.d(25): Error: template main.f3(T,U : Int!(T)) cannot deduce template
function from argument types !()(int,int[])
main.d(26): Error: template main.f3 does not match any function template
declaration
main.d(26): Error: template main.f3(T,U : Int!(T)) cannot deduce template
function from argument types !()(int,void[])
main.d(27): Error: template main.f3 does not match any function template
declaration
main.d(27): Error: template main.f3(T,U : Int!(T)) cannot deduce template
function from argument types !()(int,typeof(null))
main.d(32): Error: template main.f4 does not match any function template
declaration
main.d(32): Error: template main.f4(T,U : V,V = Int!(T)) cannot deduce template
function from argument types !()(int,typeof(null))
main.d(36): Error: template main.f5 does not match any function template
declaration
main.d(36): Error: template main.f5(T,U = Int!(T)) if (is(U == Int!(T))) cannot
deduce template function from argument types !()(int,void[])
---

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