Created on 2012-04-16.00:00:00 last changed 131 months ago
[Moved to DR at the April, 2013 meeting.]
Proposed resolution (October, 2012):
Add the following as a new bullet in 13.7.6.1 [temp.spec.partial.general] paragraph 9:
...
The argument list of the specialization shall not be identical to the implicit argument list of the primary template.
The specialization shall be more specialized than the primary template (13.7.6.3 [temp.spec.partial.order]).
...
Consider an example like
template <int B, typename Type1, typename... Types> struct A; template<typename... Types> struct A<0, Types...> { }; A<0,int,int> t;
In this case, the partial specialization seems well-formed by the rules in 13.7.6 [temp.spec.partial], but it is not more specialized than the primary template. However, 13.7.6.2 [temp.spec.partial.match] says that if exactly one matching specialization is found, it is used, which suggests that the testcase is well-formed. That seems undesirable; I think a partial specialization that is not more specialized than the primary template should be ill-formed.
If the example is rewritten so that both versions are partial specializations, i.e.,
template <int B, typename... Types> struct A; template <int B, typename Type1, typename... Types> struct A<B, Type1, Types...> { } template<typename... Types> struct A<0, Types...> { }; A<0,int,int> t;
There is implementation variance, with gcc and clang reporting an ambiguity and EDG choosing the second specialization.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
2013-10-14 00:00:00 | admin | set | status: dr -> drwp |
2013-05-03 00:00:00 | admin | set | messages: + msg4426 |
2013-05-03 00:00:00 | admin | set | status: ready -> dr |
2012-11-03 00:00:00 | admin | set | messages: + msg4070 |
2012-11-03 00:00:00 | admin | set | status: open -> ready |
2012-04-16 00:00:00 | admin | create |