diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cd341f73d22de00a917dc4971a30a415f701e5da..70caa2dd9d8e9fc9cd66ac1bbcecc9a772b97028 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 a927b6c23602137774109afce5d37fe38f780043..fd5fcfacf68ef718690e20ed982518ab5d0a4603 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 1e5b767cf106e99462bbadbda8c1d9d7be4f10cf..e13135c66c8c42dec96c8ddfbc4abed239ed23ba 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 0000000000000000000000000000000000000000..964d1d7afc354f22fd2543ce260420880f57b8a0
--- /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);
+}