This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7033: [3.3/3.4 regression] [2003-05-30] Partial template specializations accepted even if a template parameter is used in a non-deduced context
- From: "Giovanni Bajo" <giovannibajo at libero dot it>
- To: <gcc-gnats at gcc dot gnu dot org>,<Theodore dot Papadopoulo at sophia dot inria dot fr>,<gcc-bugs at gcc dot gnu dot org>,<nobody at gcc dot gnu dot org>,<gcc-prs at gcc dot gnu dot org>,<Lionel dot Champalaune at sophia dot inria dot fr>
- Date: Mon, 5 May 2003 13:20:01 +0200
- Subject: Re: c++/7033: [3.3/3.4 regression] [2003-05-30] Partial template specializations accepted even if a template parameter is used in a non-deduced context
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7033
The specialization should not be selected because §14.8.2.4p4 clearly
specifies that A<T>::B<Q> is a non-deduced context for both T and Q.
But there's more: I'm confident that defining a partial template
specialization whose arguments can't be fully deduced from the arguments of
the original template is ill-formed. In fact, GCC correctly rejects this:
-----------------------------------------------
template <class> struct K;
template <class T>
struct K<int> {};
-----------------------------------------------
pr7033.cpp:4: error: template parameters not used in partial specialization:
pr7033.cpp:4: error: `T'
but it fails to reject this:
-----------------------------------------------
template <typename, typename> struct S;
template <template <typename> class C,
typename T,
typename V>
struct S<C<T>,typename C<T>::template it<V> > {};
-----------------------------------------------
which is currently accepted by 3.3 and 3.4, even if "V" is used only in
non-deduced contexts. This is a regression (rechecked on CVS 20050305 for
both 3.3 and 3.4) with respect to 2.95 which was rejecting the code:
pr7033.cpp:6: template parameters not used in partial specialization:
pr7033.cpp:6: `V'
(actually, the error message could be "template parameter used in
non-decuded context", but anyway).
This is a reject-legal regression, and I now flagged it as such.
Giovanni Bajo