diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-07-31 09:10:58 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-07-31 09:10:58 +0000 |
commit | fb5ce3c93a8f904d786aed712e5df6f0d53f0241 (patch) | |
tree | 124bcabd3bfecaca917061b037a6d5339781e848 | |
parent | 8c6ab2db94dd89afd71a17768dac974ff91cbe8f (diff) | |
download | gcc-fb5ce3c93a8f904d786aed712e5df6f0d53f0241.zip gcc-fb5ce3c93a8f904d786aed712e5df6f0d53f0241.tar.gz gcc-fb5ce3c93a8f904d786aed712e5df6f0d53f0241.tar.bz2 |
re PR c++/11347 (Error on valid expression in default value for int argument to inner template.)
cp:
PR c++/11347
* pt.c (instantiate_class_template): Increment
processing_template_decl around the tsubst of a template member
class.
(tsubst_qualified_id): Assert we do not have a dependent scope.
testsuite:
PR c++/11347
* g++.dg/template/memtmpl1.C: New.
From-SVN: r69994
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/memtmpl1.C | 20 |
4 files changed, 39 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 110579e..2f96f95 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2003-07-31 Nathan Sidwell <nathan@codesourcery.com> + PR c++/11347 + * pt.c (instantiate_class_template): Increment + processing_template_decl around the tsubst of a template member + class. + (tsubst_qualified_id): Assert we do not have a dependent scope. + * pt.c (coerce_template_template_parms, lookup_template_class, can_complete_type_without_circularity, instantiate_class_template, tsubst_decl, unify): Reformat. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 07df30d..a1f57dc 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5318,7 +5318,11 @@ instantiate_class_template (tree type) restore these. */ input_location = DECL_SOURCE_LOCATION (t); + if (TREE_CODE (t) == TEMPLATE_DECL) + processing_template_decl++; r = tsubst (t, args, tf_error | tf_warning, NULL_TREE); + if (TREE_CODE (t) == TEMPLATE_DECL) + processing_template_decl--; if (TREE_CODE (r) == VAR_DECL) { tree init; @@ -7140,22 +7144,13 @@ tsubst_qualified_id (tree qualified_id, tree args, else expr = name; - /* This case can occur while determining which of two templates is - the more specialized. After performing argument deduction, we - check that no invalid types are created. During that phase, we - may seem uninstantiated template parameters. */ - if (TREE_CODE (scope) == BOUND_TEMPLATE_TEMPLATE_PARM) - { - if (is_template) - expr = lookup_template_function (expr, template_args); - return build_nt (SCOPE_REF, scope, expr); - } - + my_friendly_assert (!dependent_type_p (scope), 20030729); + if (!BASELINK_P (name) && !DECL_P (expr)) expr = lookup_qualified_name (scope, expr, /*is_type_p=*/0, false); + if (DECL_P (expr)) - check_accessibility_of_qualified_id (expr, - /*object_type=*/NULL_TREE, + check_accessibility_of_qualified_id (expr, /*object_type=*/NULL_TREE, scope); /* Remember that there was a reference to this entity. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index da8136e..fb4910b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-07-31 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/11347 + * g++.dg/template/memtmpl1.C: New. + 2003-07-29 Andrew Pinski <pinskia@physics.uc.edu> PR target/11565 diff --git a/gcc/testsuite/g++.dg/template/memtmpl1.C b/gcc/testsuite/g++.dg/template/memtmpl1.C new file mode 100644 index 0000000..260dbf8 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/memtmpl1.C @@ -0,0 +1,20 @@ +// { dg-do compile } + +// Copyright (C) 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 30 Jul 2003 <nathan@codesourcery.com> + +// PR 11347. ICE in tsubst + +template <class T> struct T1 { + enum {N}; +}; + +template<class T> struct T2 { + template <class S, bool Z = T1<S>::N + 1> struct B {}; + struct C {}; +}; + +T2<int> t; + +T2<int>::B<int> s; + |