+2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * pt.c (unify): Handle when both ARG and PARM are
+ BOUND_TEMPLATE_TEMPLATE_PARM.
+
2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* pt.c (reduce_template_parm_level): Set DECL_ARTIFICIAL and
if (TREE_CODE (parm) == BOUND_TEMPLATE_TEMPLATE_PARM)
{
- /* ARG must be constructed from a template class. */
- if (TREE_CODE (arg) != RECORD_TYPE || !CLASSTYPE_TEMPLATE_INFO (arg))
+ /* ARG must be constructed from a template class or a template
+ template parameter. */
+ if (TREE_CODE (arg) != BOUND_TEMPLATE_TEMPLATE_PARM
+ && (TREE_CODE (arg) != RECORD_TYPE || !CLASSTYPE_TEMPLATE_INFO (arg)))
return 1;
{
tree parmtmpl = TYPE_TI_TEMPLATE (parm);
tree parmvec = TYPE_TI_ARGS (parm);
- tree argvec = CLASSTYPE_TI_ARGS (arg);
+ tree argvec = TYPE_TI_ARGS (arg);
tree argtmplvec
- = DECL_INNERMOST_TEMPLATE_PARMS (CLASSTYPE_TI_TEMPLATE (arg));
+ = DECL_INNERMOST_TEMPLATE_PARMS (TYPE_TI_TEMPLATE (arg));
int i;
/* The parameter and argument roles have to be switched here
return 1;
}
}
- arg = CLASSTYPE_TI_TEMPLATE (arg);
+ arg = TYPE_TI_TEMPLATE (arg);
/* Fall through to deduce template name. */
}
+2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * g++.old-deja/g++.pt/ttp65.C: New test.
+
2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* g++.old-deja/g++.pt/ttp64.C: New test.
--- /dev/null
+// Build don't link:
+
+// Copyright (C) 2000 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+// Bug: We used reject template unification of two bound template template
+// parameters.
+
+template <class T, class U=int> class C
+{
+};
+
+template <class T, class U> void f(C<T,U> c)
+{
+}
+
+template <class T> void f(C<T> c)
+{
+}
+
+template <template<class,class=int> class C, class T, class U>
+void g(C<T,U> c)
+{
+}
+
+template <template<class,class=int> class C, class T> void g(C<T> c)
+{
+}
+
+int main()
+{
+ C<int,char> c1;
+ f(c1);
+ g(c1);
+ C<int,int> c2;
+ f(c2);
+ g(c2);
+}