This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13640] New: [3.3/3.4 regression] Failing to reject class template partial specialization which can never be selected
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jan 2004 20:08:30 -0000
- Subject: [Bug c++/13640] New: [3.3/3.4 regression] Failing to reject class template partial specialization which can never be selected
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This is basically c++/7033, cleaned and simplified. Comment 6 (quoting myself):
---------------------------------------------------------------------------
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 an accepts-invalid regression, and I now flagged it as such.
---------------------------------------------------------------------------
I am not sure the code is ill-formed. Maybe the specialization can be created
but it makes no sense. Since we *used* to reject this, and we are silently
accepting it now, we still have a regression. At the very least, we should
emit a friendly warning for the user.
--
Summary: [3.3/3.4 regression] Failing to reject class template
partial specialization which can never be selected
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: giovannibajo at libero dot it
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13640