From 6bf92cb6097c0efb59cab150cf308322256fb28c Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Thu, 26 Feb 2004 20:46:08 +0000 Subject: re PR c++/14284 (Failure to select obvious template specialisation) PR c++/14284 * pt.c (dependent_type_p_r): A template template parameter is a dependent type. PR c++/14284 * g++.dg/template/ttp8.C: New test. From-SVN: r78522 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 7 +++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/ttp8.C | 16 ++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/ttp8.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 85ee089..affca567 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2004-02-26 Giovanni Bajo + PR c++/14284 + * pt.c (dependent_type_p_r): A template template parameter is a + dependent type. + +2004-02-26 Giovanni Bajo + PR c++/14246 * mangle.c (write_template_arg_literal): Don't rely on identity for boolean constants. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1f97a53..7a08edaf 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11544,8 +11544,11 @@ dependent_type_p_r (tree type) A type is dependent if it is: - -- a template parameter. */ - if (TREE_CODE (type) == TEMPLATE_TYPE_PARM) + -- a template parameter. Template template parameters are + types for us (since TYPE_P holds true for them) so we + handle them here. */ + if (TREE_CODE (type) == TEMPLATE_TYPE_PARM + || TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM) return true; /* -- a qualified-id with a nested-name-specifier which contains a class-name that names a dependent type or whose unqualified-id diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 508a192..f66cd59 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-02-26 Giovanni Bajo + + PR c++/14284 + * g++.dg/template/ttp8.C: New test. + 2004-02-26 Eric Botcazou * gcc.dg/fixuns-trunc-1.c: New test. diff --git a/gcc/testsuite/g++.dg/template/ttp8.C b/gcc/testsuite/g++.dg/template/ttp8.C new file mode 100644 index 0000000..99f99b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ttp8.C @@ -0,0 +1,16 @@ +// { dg-do compile } +// Contributed by: Niall Douglas +// PR c++/14284: Failure to select specialization + +template struct S; +template class> struct I {}; + +template struct Match; + +template class C> +struct Match, 0> {}; + +template class C, int i> +struct Match, i>; + +Match, 0> v; -- cgit v1.1