digitalmars.D.bugs - [Issue 8202] New: Templated function with multiple parameters fails to compile with only one argument if type is not exact
- d-bugmail puremagic.com (47/47) Jun 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8202
- d-bugmail puremagic.com (11/11) Jun 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8202
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 puremagic.com ReportedBy: jmdavisProg gmx.com --- Comment #0 from Jonathan M Davis <jmdavisProg 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: -------
Jun 06 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8202 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2012-06-06 04:25:11 PDT --- *** This issue has been marked as a duplicate of issue 8129 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 06 2012