re PR c++/14284 (Failure to select obvious template specialisation)
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>
Thu, 26 Feb 2004 20:46:08 +0000 (20:46 +0000)
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>
Thu, 26 Feb 2004 20:46:08 +0000 (20:46 +0000)
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
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/ttp8.C [new file with mode: 0644]

index 85ee089..affca56 100644 (file)
@@ -1,5 +1,11 @@
 2004-02-26  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
+       PR c++/14284
+       * pt.c (dependent_type_p_r): A template template parameter is a
+       dependent type.
+
+2004-02-26  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
        PR c++/14246
        * mangle.c (write_template_arg_literal): Don't rely on identity for
        boolean constants.
index 1f97a53..7a08eda 100644 (file)
@@ -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
index 508a192..f66cd59 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-26  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
+       PR c++/14284
+       * g++.dg/template/ttp8.C: New test.
+
 2004-02-26  Eric Botcazou  <ebotcazou@act-europe.fr>
 
        * 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 (file)
index 0000000..99f99b9
--- /dev/null
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// Contributed by: Niall Douglas <s_gccbugzilla at netprod dot com>
+// PR c++/14284: Failure to select specialization 
+
+template<typename> struct S; 
+template<template<class> class> struct I {}; 
+template<class, int> struct Match; 
+template<template<class> class C> 
+struct Match<I<C>, 0> {}; 
+template<template<class> class C, int i> 
+struct Match<I<C>, i>; 
+Match<I<S>, 0> v;