Commit b429fdf0 by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

pt.c (unify): Handle when both ARG and PARM are BOUND_TEMPLATE_TEMPLATE_PARM.

	* pt.c (unify): Handle when both ARG and PARM are
	BOUND_TEMPLATE_TEMPLATE_PARM.

	* g++.old-deja/g++.pt/ttp65.C: New test.

From-SVN: r38301
parent c2beae77
2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 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 * pt.c (reduce_template_parm_level): Set DECL_ARTIFICIAL and
DECL_TEMPLATE_PARM_P. DECL_TEMPLATE_PARM_P.
......
...@@ -8417,16 +8417,18 @@ unify (tparms, targs, parm, arg, strict) ...@@ -8417,16 +8417,18 @@ unify (tparms, targs, parm, arg, strict)
if (TREE_CODE (parm) == BOUND_TEMPLATE_TEMPLATE_PARM) if (TREE_CODE (parm) == BOUND_TEMPLATE_TEMPLATE_PARM)
{ {
/* ARG must be constructed from a template class. */ /* ARG must be constructed from a template class or a template
if (TREE_CODE (arg) != RECORD_TYPE || !CLASSTYPE_TEMPLATE_INFO (arg)) template parameter. */
if (TREE_CODE (arg) != BOUND_TEMPLATE_TEMPLATE_PARM
&& (TREE_CODE (arg) != RECORD_TYPE || !CLASSTYPE_TEMPLATE_INFO (arg)))
return 1; return 1;
{ {
tree parmtmpl = TYPE_TI_TEMPLATE (parm); tree parmtmpl = TYPE_TI_TEMPLATE (parm);
tree parmvec = TYPE_TI_ARGS (parm); tree parmvec = TYPE_TI_ARGS (parm);
tree argvec = CLASSTYPE_TI_ARGS (arg); tree argvec = TYPE_TI_ARGS (arg);
tree argtmplvec tree argtmplvec
= DECL_INNERMOST_TEMPLATE_PARMS (CLASSTYPE_TI_TEMPLATE (arg)); = DECL_INNERMOST_TEMPLATE_PARMS (TYPE_TI_TEMPLATE (arg));
int i; int i;
/* The parameter and argument roles have to be switched here /* The parameter and argument roles have to be switched here
...@@ -8455,7 +8457,7 @@ unify (tparms, targs, parm, arg, strict) ...@@ -8455,7 +8457,7 @@ unify (tparms, targs, parm, arg, strict)
return 1; return 1;
} }
} }
arg = CLASSTYPE_TI_TEMPLATE (arg); arg = TYPE_TI_TEMPLATE (arg);
/* Fall through to deduce template name. */ /* Fall through to deduce template name. */
} }
......
2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 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. * g++.old-deja/g++.pt/ttp64.C: New test.
2000-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 2000-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
......
// 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment