[Issue 8202] New: Templated function with multiple parameters fails to compile with only one argument if type is not exact
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 6 00:56:38 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8202
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
AssignedTo: nobody at puremagic.com
ReportedBy: jmdavisProg at gmx.com
--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-06-06 00:58:39 PDT ---
This code
void func(T, R)(R range, T value)
{
}
void main()
{
ubyte[] buffer = [0, 1, 2];
buffer.func!ushort(915);
}
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);
or
buffer.func!ushort(cast(ushort)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];
buffer.func!(ubyte[])(915);
}
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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list