aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-07-17 16:29:25 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-07-17 12:29:25 -0400
commitc3baf4b55a2413dc791ce48f95be38c8c6bcd765 (patch)
tree3830f6062ef3e0e2da9980b7347ae9abe98b443c /gcc
parent402cdad5e7e27154bfeb296fbcdc67a30cf586c9 (diff)
downloadgcc-c3baf4b55a2413dc791ce48f95be38c8c6bcd765.zip
gcc-c3baf4b55a2413dc791ce48f95be38c8c6bcd765.tar.gz
gcc-c3baf4b55a2413dc791ce48f95be38c8c6bcd765.tar.bz2
pt.c (lookup_template_class): Don't mess with the context of the instantiation.
* pt.c (lookup_template_class): Don't mess with the context of the instantiation. * decl2.c (current_decl_namespace): Remove special handling for templates. From-SVN: r21265
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl2.c10
-rw-r--r--gcc/cp/pt.c21
3 files changed, 11 insertions, 25 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d58646e..7d5fb71f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
1998-07-17 Jason Merrill <jason@yorick.cygnus.com>
+ * pt.c (lookup_template_class): Don't mess with the context of the
+ instantiation.
+ * decl2.c (current_decl_namespace): Remove special handling for
+ templates.
+
* pt.c (tsubst, case FUNCTION_DECL): Fix getting complete args for
a member template specialization.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 6713c65..e484e6d 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4136,15 +4136,9 @@ current_decl_namespace ()
return TREE_PURPOSE (decl_namespace_list);
if (current_class_type)
- if (CLASSTYPE_USE_TEMPLATE (current_class_type))
- result = decl_namespace (CLASSTYPE_TI_TEMPLATE (current_class_type));
- else
- result = decl_namespace (TYPE_STUB_DECL (current_class_type));
+ result = decl_namespace (TYPE_STUB_DECL (current_class_type));
else if (current_function_decl)
- if (DECL_USE_TEMPLATE (current_function_decl))
- result = decl_namespace (DECL_TI_TEMPLATE (current_function_decl));
- else
- result = decl_namespace (current_function_decl);
+ result = decl_namespace (current_function_decl);
else
result = current_namespace;
return result;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e982c92..ed23223 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2985,7 +2985,7 @@ lookup_template_class (d1, arglist, in_decl, context)
{
tree template = NULL_TREE, parmlist;
char *mangled_name;
- tree id, t, id_context;
+ tree id, t;
if (TREE_CODE (d1) == IDENTIFIER_NODE)
{
@@ -3030,12 +3030,6 @@ lookup_template_class (d1, arglist, in_decl, context)
else
my_friendly_abort (272);
- /* A namespace is used as context only for mangling.
- Template IDs with namespace context are found
- in the global binding level. */
- if (context != NULL_TREE && TREE_CODE (context) == NAMESPACE_DECL)
- context = global_namespace;
-
/* With something like `template <class T> class X class X { ... };'
we could end up with D1 having nothing but an IDENTIFIER_LOCAL_VALUE.
We don't want to do that, but we have to deal with the situation, so
@@ -3043,15 +3037,8 @@ lookup_template_class (d1, arglist, in_decl, context)
if (! template)
return error_mark_node;
- /* We need an id_context to get the mangling right. If this is a
- nested template, use the context. If it is global, retrieve the
- context from the template. */
- if (context && TREE_CODE (context) != NAMESPACE_DECL)
- id_context = context;
- else
- id_context = DECL_CONTEXT (template);
- if (id_context == NULL_TREE)
- id_context = global_namespace;
+ if (context == NULL_TREE)
+ context = global_namespace;
if (TREE_CODE (template) != TEMPLATE_DECL)
{
@@ -3154,7 +3141,7 @@ lookup_template_class (d1, arglist, in_decl, context)
mangled_name = mangle_class_name_for_template (IDENTIFIER_POINTER (d1),
parmlist,
arglist_for_mangling,
- id_context);
+ context);
id = get_identifier (mangled_name);
IDENTIFIER_TEMPLATE (id) = d1;