summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-28 20:53:04 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-28 20:53:04 +0000
commit0cb38f3ea4061d3c0045facb63df032c399a2910 (patch)
treed67de648c09e8c1810110d9aea2eda23c21b75cc /gcc/cp
parent3e20eb32e75e70f3e3b68778733a02cf03722581 (diff)
downloadgcc-0cb38f3ea4061d3c0045facb63df032c399a2910.tar.gz
PR c++/17132
* pt.c (instantiate_class_template): Increment processing_template_decl when substituting into a member class template. PR c++/17132 * g++.dg/template/memclass3.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89778 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/pt.c18
2 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ee2ae82a54a..2edaa402f21 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2004-10-28 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/17132
+ * pt.c (instantiate_class_template): Increment
+ processing_template_decl when substituting into a member class
+ template.
+
2004-10-27 Mark Mitchell <mark@codesourcery.com>
PR c++/17435
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 99f4e7b9602..eb44e64b9b9 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5621,14 +5621,28 @@ instantiate_class_template (tree type)
tree tag = t;
tree name = TYPE_IDENTIFIER (tag);
tree newtag;
-
+ bool class_template_p;
+
+ class_template_p = (TREE_CODE (tag) != ENUMERAL_TYPE
+ && TYPE_LANG_SPECIFIC (tag)
+ && CLASSTYPE_IS_TEMPLATE (tag));
+ /* If the member is a class template, then -- even after
+ substituition -- there may be dependent types in the
+ template argument list for the class. We increment
+ PROCESSING_TEMPLATE_DECL so that dependent_type_p, as
+ that function will assume that no types are dependent
+ when outside of a template. */
+ if (class_template_p)
+ ++processing_template_decl;
newtag = tsubst (tag, args, tf_error, NULL_TREE);
+ if (class_template_p)
+ --processing_template_decl;
if (newtag == error_mark_node)
continue;
if (TREE_CODE (newtag) != ENUMERAL_TYPE)
{
- if (TYPE_LANG_SPECIFIC (tag) && CLASSTYPE_IS_TEMPLATE (tag))
+ if (class_template_p)
/* Unfortunately, lookup_template_class sets
CLASSTYPE_IMPLICIT_INSTANTIATION for a partial
instantiation (i.e., for the type of a member