This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH for labels/templates



Lee --

  Here's a patch for your problem.  Jason, OK?

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

1998-05-27  Mark Mitchell  <mark@markmitchell.com>

	* decl.c (shadow_label): Don't treat decls as identifiers.
	(push_cp_function_context): Clear shadowed_labels.
	
Index: label1.C
===================================================================
RCS file: label1.C
diff -N label1.C
*** /dev/null	Mon Dec 31 20:00:00 1979
--- label1.C	Wed May 27 16:25:41 1998
***************
*** 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);
+ }
Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.125
diff -c -p -r1.125 decl.c
*** decl.c	1998/05/27 07:07:20	1.125
--- decl.c	1998/05/27 22:40:17
*************** shadow_label (name)
*** 4106,4112 ****
      {
        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);
--- 4106,4111 ----
*************** push_cp_function_context (context)
*** 13280,13285 ****
--- 13279,13286 ----
    p->current_class_ptr = current_class_ptr;
    p->current_class_ref = current_class_ref;
    p->static_labelno = static_labelno;
+ 
+   shadowed_labels = NULL_TREE;
  }
  
  /* Restore the variables used during compilation of a C++ function.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]