Summary: Templated function with multiple parameters fails to
                    compile with only one argument if type is not exact
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Jonathan M Davis <> 2012-06-06 00:58:39 
PDT ---
This code

void func(T, R)(R range, T value)

void main()
    ubyte[] buffer = [0, 1, 2];

fails to compile, giving

q.d(8): Error: template q.func does not match any function template declaration
q.d(1): Error: template q.func(T,R) cannot deduce template function from
argument types !(ushort)(ubyte[],int)
q.d(8): Error: template instance func!(ushort) errors instantiating template

If I change the function call to either

buffer.func!(ushort, ubyte[])(915);



then it compiles. It will also compile if you change it to

void func(R, T)(R range, T value)

void main()
    ubyte[] buffer = [0, 1, 2];

But for some reason, the compiler cannot handle having just one of the two
template parameters given when the function argument associated with the given
template parameter is not an exact match.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to