diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2b1b453526c..92907b8d638 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-10-13 Kriang Lerdsuwanakij + + * pt.c (lookup_template_class): Build complete template arguments + for BOUND_TEMPLATE_TEMPLATE_PARM. + 2001-10-12 Kriang Lerdsuwanakij * cp-tree.h (TYPE_BINFO): Update comment. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index cd68629ab92..e2904b5cf5f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3913,6 +3913,19 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) parmlist = DECL_INNERMOST_TEMPLATE_PARMS (template); + /* Consider an example where a template template parameter declared as + + template > class TT + + The template parameter level of T and U are one level larger than + of TT. To proper process the default argument of U, say when an + instantiation `TT' is seen, we need to build the full + arguments containing {int} as the innermost level. Outer levels + can be obtained from `current_template_args ()'. */ + + if (processing_template_decl) + arglist = add_to_template_args (current_template_args (), arglist); + arglist2 = coerce_template_parms (parmlist, arglist, template, complain, /*require_all_args=*/1); if (arglist2 == error_mark_node) diff --git a/gcc/testsuite/g++.dg/template/ttp2.C b/gcc/testsuite/g++.dg/template/ttp2.C new file mode 100644 index 00000000000..45d9abddfe2 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ttp2.C @@ -0,0 +1,17 @@ +// Copyright (C) 2001 Free Software Foundation +// Contributed by Kriang Lerdsuwanakij +// { dg-do compile } + +template struct Alloc {}; + +template > struct Vector {}; + +template