diff options
author | Benjamin Kosnik <bkoz@rhino.cygnus.com> | 1997-12-18 13:03:54 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 1997-12-18 13:03:54 +0000 |
commit | 4f4da4e99bbb2464aa37b00ba12f734b7c86db06 (patch) | |
tree | 4e24dd44f3d33dc37995b897ef2695ed71eda672 | |
parent | 80aab652d43c4bfd855ff6340c2058fabf5b0970 (diff) | |
download | gcc-4f4da4e99bbb2464aa37b00ba12f734b7c86db06.zip gcc-4f4da4e99bbb2464aa37b00ba12f734b7c86db06.tar.gz gcc-4f4da4e99bbb2464aa37b00ba12f734b7c86db06.tar.bz2 |
c++: Don't inject friends while processing templates
* pt.c (instantiate_class_template): Don't do injection when
processing_template_decl is true, as pollutes current_binding_level
for base classes.
PR g++/13911/14438
From-SVN: r17128
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 22 |
2 files changed, 19 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2cf2aa8..c6bd7b6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +Wed Dec 17 17:08:52 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com> + + * pt.c (instantiate_class_template): Don't do injection when + processing_template_decl is true, as pollutes current_binding_level + for base classes. + Wed Dec 17 21:17:39 1997 Peter Schmid <schmid@ltoi.iap.physik.tu-darmstadt.de> * pt.c (maybe_fold_nontype_arg): Add prototype. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5e540fb..c1cfa92 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1956,18 +1956,22 @@ instantiate_class_template (type) for (; d; d = TREE_CHAIN (d)) TREE_VALUE (d) = xref_tag_from_type (TREE_VALUE (d), NULL_TREE, 1); - d = tsubst (DECL_TEMPLATE_INJECT (template), args, + /* This does injection for friend functions. */ + if (!processing_template_decl) + { + d = tsubst (DECL_TEMPLATE_INJECT (template), args, TREE_VEC_LENGTH (args), NULL_TREE); - for (; d; d = TREE_CHAIN (d)) - { - tree t = TREE_VALUE (d); + for (; d; d = TREE_CHAIN (d)) + { + tree t = TREE_VALUE (d); - if (TREE_CODE (t) == TYPE_DECL) - /* Already injected. */; - else - pushdecl (t); - } + if (TREE_CODE (t) == TYPE_DECL) + /* Already injected. */; + else + pushdecl (t); + } + } } if (! uses_template_parms (type)) |