Bug 49505 - [DR 214] wrong partial ordering for explicit instantiation with unused template parameter
Summary: [DR 214] wrong partial ordering for explicit instantiation with unused templa...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks: c++-core-issues
  Show dependency treegraph
 
Reported: 2011-06-22 20:17 UTC by Jason Merrill
Modified: 2021-08-23 21:13 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-08-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Merrill 2011-06-22 20:17:06 UTC
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.