summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-31 16:39:19 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-31 16:39:19 +0000
commitc87435c8f259f7a056f44cc7b911749710e86e7c (patch)
treeab468350cfdd071d28002d537d6ee3d77b308f12 /gcc
parent8228119ea4edc3b12f2cd1913c93652c24362590 (diff)
downloadgcc-c87435c8f259f7a056f44cc7b911749710e86e7c.tar.gz
* decl.c (build_cp_library_fn): Set DECL_CONTEXT.
* method.c (mangle_expression): Adjust test for legal expression operators. * pt.c (instantiate_decl): Save and restore the local specializations list. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34302 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/decl.c1
-rw-r--r--gcc/cp/method.c10
-rw-r--r--gcc/cp/pt.c9
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/inline2.C16
5 files changed, 38 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b4512669795..6120852e859 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+2000-05-31 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (build_cp_library_fn): Set DECL_CONTEXT.
+
+ * method.c (mangle_expression): Adjust test for legal expression
+ operators.
+
+ * pt.c (instantiate_decl): Save and restore the local
+ specializations list.
+
2000-05-30 Jason Merrill <jason@decepticon.cygnus.com>
* decl.c (grok_reference_init): Pass LOOKUP_ONLYCONVERTING.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index cbee8e69868..69f6e74d9f6 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6821,6 +6821,7 @@ build_cp_library_fn (name, operator_code, type)
{
tree fn = build_library_fn_1 (name, operator_code, type);
TREE_NOTHROW (fn) = TYPE_NOTHROW_P (type);
+ DECL_CONTEXT (fn) = FROB_CONTEXT (current_namespace);
set_mangled_name_for_decl (fn);
make_function_rtl (fn);
return fn;
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 13d627ad17b..1981e77f640 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -523,13 +523,11 @@ mangle_expression (value)
const char *name;
name = operator_name_info[TREE_CODE (value)].mangled_name;
- my_friendly_assert (name != NULL, 0);
- if (name[0] != '_' || name[1] != '_')
+ if (name == NULL)
/* On some erroneous inputs, we can get here with VALUE a
- LOOKUP_EXPR. In that case, the NAME will be the
- identifier for "<invalid operator>". We must survive
- this routine in order to issue a sensible error
- message, so we fall through to the case below. */
+ LOOKUP_EXPR. We must survive this routine in order to issue
+ a sensible error message, so we fall through to the case
+ below. */
goto bad_value;
for (i = 0; i < operands; ++i)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b64fc72a72e..e414d849374 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9614,8 +9614,13 @@ instantiate_decl (d, defer_ok)
}
else if (TREE_CODE (d) == FUNCTION_DECL)
{
+ htab_t saved_local_specializations;
+
+ /* Save away the current list, in case we are instantiating one
+ template from within the body of another. */
+ saved_local_specializations = local_specializations;
+
/* Set up the list of local specializations. */
- my_friendly_assert (local_specializations == NULL, 20000422);
local_specializations = htab_create (37,
htab_hash_pointer,
htab_eq_pointer,
@@ -9635,7 +9640,7 @@ instantiate_decl (d, defer_ok)
/* We don't need the local specializations any more. */
htab_delete (local_specializations);
- local_specializations = NULL;
+ local_specializations = saved_local_specializations;
/* Finish the function. */
expand_body (finish_function (0));
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/inline2.C b/gcc/testsuite/g++.old-deja/g++.pt/inline2.C
new file mode 100644
index 00000000000..fcc1d0009dc
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/inline2.C
@@ -0,0 +1,16 @@
+// Build don't link:
+// Special g++ Options: -O
+// Origin: Mark Mitchell <mitchell@codesourcery.com>
+
+template <class T>
+struct S {
+ inline ~S () {}
+};
+
+template <class T>
+void f ()
+{
+ static S<T> s;
+}
+
+template void f<int>();