aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-05-27 19:11:36 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-05-27 19:11:36 +0000
commit120722ac7060fac7b22ae970f684b60d11a127e0 (patch)
tree2cdd3bab6c39b411dab4327a60c2f1cb0c70dd10 /gcc
parentb608647a8a9b759f5f54f9bc5a17096df6ef2f3b (diff)
downloadgcc-120722ac7060fac7b22ae970f684b60d11a127e0.zip
gcc-120722ac7060fac7b22ae970f684b60d11a127e0.tar.gz
gcc-120722ac7060fac7b22ae970f684b60d11a127e0.tar.bz2
decl.c (shadow_label): Don't treat decls as identifiers.
* decl.c (shadow_label): Don't treat decls as identifiers. (maybe_push_to_top_level): Clear shadowed_labels. * pt.c (instantiate_decl): Reset lineno and filename after calling regenerate_decl_from_template. From-SVN: r20093
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/pt.c6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/label1.C25
4 files changed, 36 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cd341f7..70caa2d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
1998-05-27 Mark Mitchell <mark@markmitchell.com>
+ * decl.c (shadow_label): Don't treat decls as identifiers.
+ (maybe_push_to_top_level): Clear shadowed_labels.
+
+ * pt.c (instantiate_decl): Reset lineno and filename after calling
+ regenerate_decl_from_template.
+
* decl.c (grokdeclarator): Don't try to use TYPE_OBSTACK on an
error_mark_node.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index a927b6c..fd5fcfa 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1992,6 +1992,7 @@ maybe_push_to_top_level (pseudo)
current_lang_name = lang_name_cplusplus;
strict_prototype = strict_prototypes_lang_cplusplus;
named_labels = NULL_TREE;
+ shadowed_labels = NULL_TREE;
minimal_parse_mode = 0;
previous_class_type = previous_class_values = NULL_TREE;
processing_specialization = 0;
@@ -4106,7 +4107,6 @@ shadow_label (name)
{
shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels);
SET_IDENTIFIER_LABEL_VALUE (name, NULL_TREE);
- SET_IDENTIFIER_LABEL_VALUE (decl, NULL_TREE);
}
return lookup_label (name);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1e5b767..e13135c 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7158,11 +7158,13 @@ instantiate_decl (d)
goto out;
}
+ regenerate_decl_from_template (d, td);
+
+ /* We already set the file and line above. Reset them now in case
+ they changed as a result of calling regenerate_decl_from_template. */
lineno = DECL_SOURCE_LINE (d);
input_filename = DECL_SOURCE_FILE (d);
- regenerate_decl_from_template (d, td);
-
if (TREE_CODE (d) == VAR_DECL)
{
DECL_IN_AGGR_P (d) = 0;
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/label1.C b/gcc/testsuite/g++.old-deja/g++.pt/label1.C
new file mode 100644
index 0000000..964d1d7
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/label1.C
@@ -0,0 +1,25 @@
+// Build don't link:
+
+template <class T>
+struct S {};
+
+template <class T>
+inline void g(T t)
+{
+ here:
+ S<T> st;
+ goto here;
+}
+
+template <class T>
+void f(T t)
+{
+ here:
+ g(t);
+ goto here;
+}
+
+void h()
+{
+ f(3);
+}