Skip to content

Commit b313809

Browse files
committed
Show that you can't goto into optimized-away construct
Incorporating suggestions from Lukas Mai. Use less generic names for labels in test files. Fixes: GH #23810
1 parent d8c30f3 commit b313809

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

t/op/goto.t

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ BEGIN {
1212
use warnings;
1313
use strict;
1414
use Config;
15-
plan tests => 96;
15+
plan tests => 97;
1616

1717
our $TODO;
1818

@@ -691,3 +691,17 @@ is $@,'', 'goto the first parameter of a binary expression [perl #132854]';
691691
GH23806skip:
692692
is $x, "good", "goto EXPR exempt from 'looks like a function' rule";
693693
}
694+
695+
# [GH #23810]
696+
{
697+
local $@;
698+
eval {
699+
goto GH23810;
700+
if (0) {
701+
GH23810: ;
702+
}
703+
};
704+
like($@, qr/^Can't find label GH23810/,
705+
"goto LABEL can't be used to go into a construct that is optimized away");
706+
}
707+

0 commit comments

Comments
 (0)