diff options
author | Zefram <zefram@fysh.org> | 2017-01-23 02:25:50 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2017-01-23 22:25:42 +0000 |
commit | 3c157b3cf0631c69ffa5aa2d55b9199bf93b22a9 (patch) | |
tree | d7f916b738c0777c551896e40c7fb6a96830a56e /t/op/goto.t | |
parent | 7cb258c16018b4c963dd48cee7578d26045ff04c (diff) | |
download | perl-3c157b3cf0631c69ffa5aa2d55b9199bf93b22a9.tar.gz |
permit goto at top level of multicalled sub
A multicalled sub is reckoned to be a pseudo block, out of which it is
not permissible to goto. However, the test for a pseudo block was being
applied too early, preventing not just escape from a multicalled sub but
also a goto at the top level within the sub. This is a bug similar, but
not identical, to [perl #113938]. Now the test is deferred, permitting
goto at the sub's top level but still forbidding goto out of it.
Diffstat (limited to 't/op/goto.t')
-rw-r--r-- | t/op/goto.t | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/t/op/goto.t b/t/op/goto.t index 05f1573077..f2f2a25af0 100644 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -10,7 +10,7 @@ BEGIN { use warnings; use strict; -plan tests => 99; +plan tests => 100; our $TODO; my $deprecated = 0; @@ -801,3 +801,12 @@ TODO: { } EOC } + +sub revnumcmp ($$) { + goto FOO; + die; + FOO: + return $_[1] <=> $_[0]; +} +is eval { join(":", sort revnumcmp (9,5,1,3,7)) }, "9:7:5:3:1", + "can goto at top level of multicalled sub"; |