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

           Summary: template function not working against template struct
                    instantiated with default arguments
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: and...@metalanguage.com


The following code doesn't compile:

struct S(T, int x = 1){}

S!(T, x) fun(T, int x)(T a, S!(T, x) b) {return b;}

void main()
{
    S!(int) s;
    s = fun(2, s);
}

Error message: 

./test.d(nn): template test.fun(T,int x) does not match any function template
declaration
./test.d(nn): template test.fun(T,int x) cannot deduce template function from
argument types !()(int,S!(int))
./test.d(nn): Error: cannot implicitly convert expression ((fun(T,int
x))(2,s))of type int to S!(int)

Changing the definition of s to:

    S!(int, 4) s;

makes the code work, so I presume it's a simple bug.


-- 

Reply via email to