This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
PATCH for Re: labels don't work in template functions
- To: pfeifer at dbai dot tuwien dot ac dot at
- Subject: PATCH for Re: labels don't work in template functions
- From: Mark Mitchell <mmitchell at usa dot net>
- Date: Tue, 24 Mar 1998 11:27:38 -0800
- CC: egcs-bugs at cygnus dot com
- References: <Pine.GSO.3.96.980324141407.26450M-100000@alcyone.dbai.tuwien.ac.at>
- Reply-to: mmitchell at usa dot net
>>>>> "Gerald" == Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> writes:
Gerald> (At least) today's CVS snapshot breaks the following code:
Gerald> -------- snipedee -------- template<class T> void
Gerald> compute(T) { goto Exit; Exit: ; }
Gerald> main() { compute(0); } -------- snipedee --------
Here's a fix. Jason?
--
Mark Mitchell <mmitchell@usa.net>
http://home.earthlink.net/~mbmitchell
Consulting Services Available
Tue Mar 24 11:25:30 1998 Mark Mitchell <mmitchell@usa.net>
* pt.c (tsubst_expr): Handle GOTO_STMT correctly.
Index: cp/pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.104
diff -c -p -r1.104 pt.c
*** pt.c 1998/03/24 10:25:40 1.104
--- pt.c 1998/03/24 19:23:52
*************** tsubst_expr (t, args, in_decl)
*** 5077,5084 ****
case GOTO_STMT:
lineno = TREE_COMPLEXITY (t);
! finish_goto_stmt (tsubst_expr (GOTO_DESTINATION (t),
! args, in_decl));
break;
case ASM_STMT:
--- 5082,5094 ----
case GOTO_STMT:
lineno = TREE_COMPLEXITY (t);
! t = GOTO_DESTINATION (t);
! if (TREE_CODE (t) != IDENTIFIER_NODE)
! /* Computed goto's must be tsubst'd into. On the other hand,
! non-computed gotos must not be; the identifier in question
! will have no binding. */
! t = tsubst_expr (t, args, in_decl);
! finish_goto_stmt (t);
break;
case ASM_STMT:
Index: testsuite/g++.old-deja/g++.pt/goto.C
===================================================================
RCS file: goto.C
diff -N goto.C
*** /dev/null Mon Dec 31 20:00:00 1979
--- goto.C Tue Mar 24 11:23:52 1998
***************
*** 0 ****
--- 1,12 ----
+ // Build don't link:
+
+ template<class T>
+ void compute(T) {
+ goto Exit;
+ Exit: ;
+ }
+
+ int main()
+ {
+ compute(0);
+ }