diff options
author | Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> | 2000-12-16 07:57:21 +0000 |
---|---|---|
committer | Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org> | 2000-12-16 07:57:21 +0000 |
commit | b429fdf002777908ae76c5de195e5403fa6cb398 (patch) | |
tree | 5ac6505cdb0c3badcafb5fe18a3cdcd0972f1968 /gcc | |
parent | c2beae77c6e8fb2bd655bfc0c88bd29b162916b1 (diff) | |
download | gcc-b429fdf002777908ae76c5de195e5403fa6cb398.zip gcc-b429fdf002777908ae76c5de195e5403fa6cb398.tar.gz gcc-b429fdf002777908ae76c5de195e5403fa6cb398.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/ttp65.C | 38 |
4 files changed, 54 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7437490..f94fdc1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 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 DECL_TEMPLATE_PARM_P. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ac6fc16..3a0096e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8417,16 +8417,18 @@ unify (tparms, targs, parm, arg, strict) 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 @@ -8455,7 +8457,7 @@ unify (tparms, targs, parm, arg, strict) return 1; } } - arg = CLASSTYPE_TI_TEMPLATE (arg); + arg = TYPE_TI_TEMPLATE (arg); /* Fall through to deduce template name. */ } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b43a462..3b8b153 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 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. 2000-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ttp65.C b/gcc/testsuite/g++.old-deja/g++.pt/ttp65.C new file mode 100644 index 0000000..9f4507a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ttp65.C @@ -0,0 +1,38 @@ +// 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); +} |