+2004-07-27 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/14429
+ * pt.c (coerce_template_template_parms) <PARM_DECL case>: Only check
+ when the type of ARG is not dependent.
+
2004-07-26 Geoffrey Keating <geoffk@apple.com>
* g++spec.c (LIBSTDCXX_PROFILE): Default to LIBSTDCXX.
case PARM_DECL:
/* The tsubst call is used to handle cases such as
- template <class T, template <T> class TT> class D;
+
+ template <int> class C {};
+ template <class T, template <T> class TT> class D {};
+ D<int, C> d;
+
i.e. the parameter list of TT depends on earlier parameters. */
- if (!same_type_p
- (tsubst (TREE_TYPE (parm), outer_args, complain, in_decl),
- TREE_TYPE (arg)))
+ if (!dependent_type_p (TREE_TYPE (arg))
+ && !same_type_p
+ (tsubst (TREE_TYPE (parm), outer_args, complain, in_decl),
+ TREE_TYPE (arg)))
return 0;
break;
+2004-07-27 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/14429
+ * g++.dg/template/ttp11.C: New test.
+
2004-07-27 Diego Novillo <dnovillo@redhat.com>
* gcc.c-torture/compile/20040727-1.c: New test.
--- /dev/null
+// { dg-do compile }
+
+// Origin: heinlein@informatik.uni-ulm.de
+
+// PR c++/14429: Matching of template template parameter containing
+// non-type parameter with type that depends on earlier parameter.
+
+template <template <typename U, U* p> class T>
+struct X {};
+
+template <template <typename U, U* p> class T>
+struct Y {
+ X<T> x;
+};
--- /dev/null
+// Copyright (C) 2004 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+// { dg-do compile }
+
+// Check the type of non-type parameter in template template parameter
+// only if it is dependent.
+
+template <template <int* p> class T>
+struct X {};
+
+template <typename U, template <U* p> class T>
+struct Y {
+ X<T> x;
+};
+
+template <int* p> struct Z {};
+
+Y<int, Z> y1;
+Y<char, Z> y2; // { dg-error "mismatch|expected|invalid" }