http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49505
Summary: [DR 214] wrong partial ordering for explicit
instantiation with unused template parameter
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
template <typename T> T f(int) { return T(); }
template <typename U, typename T, typename V> T f(V);
template int f<int> (int);
Here, the first f is more specialized than the second. G++ currently rejects
this testcase as ambiguous because of the unused template parameter U, but
since DR 214 14.8.2.4 says,
In most cases, all template parameters must have values in order for deduction
to succeed, but for partial ordering purposes a template parameter may remain
without a value provided it is not used in the types being used for partial
ordering.
clang and EDG get this right.
I noticed this issue while looking at bug 22596.