This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49505] New: [DR 214] wrong partial ordering for explicit instantiation with unused template parameter
- From: "jason at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 22 Jun 2011 20:17:11 +0000
- Subject: [Bug c++/49505] New: [DR 214] wrong partial ordering for explicit instantiation with unused template parameter
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: jason@gcc.gnu.org
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.