Bug 2696 – Spurious "if"clause of template function shown in error message

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-02-28T14:51:00Z
Last change time
2014-02-14T20:35:24Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
andrei

Comments

Comment #0 by andrei — 2009-02-28T14:51:43Z
(Thanks CLXX for submitting this to the newsgroup.) void fun(T)(T t) if (is(T == string)) {} void fun(T)(T t) if (is(T == int)) {} void main( ){ fun(1.0); } yields the errors: ./test.d(5): template test.fun(T) if (is(T == string)) does not match any function template declaration ./test.d(5): template test.fun(T) if (is(T == string)) cannot deduce template function from argument types !()(double) The if (...) clause is superfluous as the compiler seems to print there whatever fun overload was first in the module. The correct error message is: ./test.d(5): template test.fun(T) does not match any function template declaration ./test.d(5): template test.fun(T) cannot deduce template function from argument type !()(double) Notice the grammar fix too :o).
Comment #1 by bugzilla — 2009-03-14T20:27:20Z
The "if" clause is printed because it is part of the template declaration, not its definition.
Comment #2 by k.hara.pg — 2012-03-25T01:16:57Z
*** This issue has been marked as a duplicate of issue 7768 ***