This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13640] [3.3/3.4 regression] Failing to reject class template partial specialization which can never be selected
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jan 2004 23:25:41 -0000
- Subject: [Bug c++/13640] [3.3/3.4 regression] Failing to reject class template partial specialization which can never be selected
- References: <20040110200828.13640.giovannibajo@libero.it>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From gdr at integrable-solutions dot net 2004-01-10 23:25 -------
Subject: Re: New: [3.3/3.4 regression] Failing to reject class template partial specialization which can never be selected
"giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:
| 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:
I disagree. Declaring/defining a partial specialization that can
never be selected by partial ordering is not ill-formed.
| -----------------------------------------------
| 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'
That situation is different. There is a note somewhere in the standard
saying that every template parameter shall be used in a partial
specialization. However, that note does not imply that the resulting
partial specialization could ever be selected by partial ordering or
template argument deduction.
| 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> > {};
| -----------------------------------------------
I'm well aware of this example -- as I used it to discuss related
topics on the committee reflector.
| which is currently accepted by 3.3 and 3.4, even if "V" is used only in
And that is allowed by the standard.
| 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'
That is a bogus behaviour.
| (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 disagree: it is not accepts-invalid.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13640