From: Rafael Garcia-Suarez Date: Wed, 8 Oct 2003 11:34:17 +0000 (+0000) Subject: Fix bug #24108: Goto +foo broken X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e3aba57ac4f86fb55aeef24f1f54bbd3531b9882;p=p5sagit%2Fp5-mst-13.2.git Fix bug #24108: Goto +foo broken the fix having been suggested by xmath via Juerd. p4raw-id: //depot/perl@21425 --- diff --git a/op.c b/op.c index 1aecdaf..f08e6a3 100644 --- a/op.c +++ b/op.c @@ -3781,7 +3781,9 @@ Perl_newLOOPEX(pTHX_ I32 type, OP *label) op_free(label); } else { - if (label->op_type == OP_ENTERSUB) + /* Check whether it's going to be a goto &function */ + if (label->op_type == OP_ENTERSUB + && !(label->op_flags & OPf_STACKED)) label = newUNOP(OP_REFGEN, 0, mod(label, OP_REFGEN)); o = newUNOP(type, OPf_STACKED, label); } diff --git a/t/op/goto.t b/t/op/goto.t index c156fd8..67d24c0 100755 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -7,7 +7,7 @@ BEGIN { @INC = qw(. ../lib); } -print "1..30\n"; +print "1..32\n"; require "test.pl"; @@ -220,6 +220,14 @@ my $r = runperl(prog => 'use goto01; print qq[DONE\n]'); is($r, "OK\nDONE\n", "goto within use-d file"); unlink "goto01.pm"; +# test for [perl #24108] +sub i_return_a_label { + print "ok 31 - i_return_a_label called\n"; + return "returned_label"; +} +eval { goto +i_return_a_label; }; +print "not "; +returned_label : print "ok 32 - done to returned_label\n"; exit;