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: Theodore Papadopoulo <Theodore dot Papadopoulo at sophia dot inria dot fr>
- To: "Giovanni Bajo" <giovannibajo at libero dot it>
- Cc: gcc-gnats at gcc dot gnu dot org, 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, Gabriel DOS_REIS <Gabriel dot Dos_Reis at sophia dot inria dot fr>
- Date: Tue, 06 May 2003 20:34:40 +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
giovannibajo@libero.it said:
> 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.
I kindly disagree.
First §14.8.2.4p4 deals with "Function template specializations" not
with "Class template specializations". The program might be invalid
but not for this reason.
Second, the specialization can fully be deduced from the template
arguments (look again), so that your second affirmation is equally
wrong. Both T and V are given in the instanciation.
Actually, looking at the standard with Gaby today, it looks like that
by §14.5.4.1p1, the unique specialization exactly matched by all the
template parameters (which is the case here) should be selected....
I do not definitely claim that the example should compile because I
do not know all the arcanes of the standard with this respect, but I
have not yet seen an argument that forbids it. And moreover,
forbidding this would be extremely surprising for the users without a
proper message explaining the reasons for that...
--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
--------------------------------------------------------------------