Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pod/perldiag.pod
Original file line number Diff line number Diff line change
Expand Up @@ -7845,6 +7845,10 @@ For speed and efficiency reasons, Perl internally does not do full
reference-counting of iterated items, hence deleting such an item in the
middle of an iteration causes Perl to see a freed value.

=item Use of "goto" to jump into a construct is no longer permitted

(F) More TO COME.

=item Use of /g modifier is meaningless in split

(W regexp) You used the /g modifier on the pattern for a C<split>
Expand Down
4 changes: 1 addition & 3 deletions pp_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3652,9 +3652,7 @@ PP(pp_goto)
? 2
: 1;
if (enterops[i])
deprecate_fatal_in(WARN_DEPRECATED__GOTO_CONSTRUCT,
"5.42",
"Use of \"goto\" to jump into a construct");
croak("Use of \"goto\" to jump into a construct is no longer permitted");
}

/* pop unwanted frames */
Expand Down
35 changes: 1 addition & 34 deletions t/comp/package_block.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!./perl

print "1..7\n";
print "1..5\n";

$main::result = "";
eval q{
Expand Down Expand Up @@ -56,37 +56,4 @@ eval q{
};
print $main::result eq "a(2)b(4)c(6)d(8)e(10)f(12)" ? "ok 5\n" : "not ok 5\n";

$main::result = "";
$main::warning = "";
$SIG{__WARN__} = sub { $main::warning .= $_[0]; };
eval q{
$main::result .= "a(".__PACKAGE__."/".eval("__PACKAGE__").")";
goto l0;
$main::result .= "b(".__PACKAGE__."/".eval("__PACKAGE__").")";
package Foo {
$main::result .= "c(".__PACKAGE__."/".eval("__PACKAGE__").")";
l0:
$main::result .= "d(".__PACKAGE__."/".eval("__PACKAGE__").")";
goto l1;
$main::result .= "e(".__PACKAGE__."/".eval("__PACKAGE__").")";
}
$main::result .= "f(".__PACKAGE__."/".eval("__PACKAGE__").")";
l1:
$main::result .= "g(".__PACKAGE__."/".eval("__PACKAGE__").")";
goto l2;
$main::result .= "h(".__PACKAGE__."/".eval("__PACKAGE__").")";
package Bar {
l2:
$main::result .= "i(".__PACKAGE__."/".eval("__PACKAGE__").")";
}
$main::result .= "j(".__PACKAGE__."/".eval("__PACKAGE__").")";
};
print $main::result eq
"a(main/main)d(Foo/Foo)g(main/main)i(Bar/Bar)j(main/main)" ?
"ok 6\n" : "not ok 6\n";
print $main::warning =~ /\A
Use\ of\ "goto"\ [^\n]*\ line\ 3\.\n
Use\ of\ "goto"\ [^\n]*\ line\ 15\.\n
\z/x ? "ok 7\n" : "not ok 7\n";

1;
9 changes: 3 additions & 6 deletions t/lib/croak/pp_ctl
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
__END__
# NAME goto into foreach
no warnings 'deprecated';
goto f;
foreach(1){f:}
EXPECT
Can't "goto" into the middle of a foreach loop at - line 3.
Use of "goto" to jump into a construct is no longer permitted at - line 1.
########
# NAME goto into given
no warnings 'deprecated';
goto f;
CORE::given(1){f:}
EXPECT
Can't "goto" into a "given" block at - line 3.
Use of "goto" to jump into a construct is no longer permitted at - line 1.
########
# NAME goto from given topic expression
no warnings 'deprecated';
CORE::given(goto f){f:}
EXPECT
Can't "goto" into a "given" block at - line 2.
Use of "goto" to jump into a construct is no longer permitted at - line 1.
########
# NAME goto into expression
no warnings 'deprecated';
Expand Down
Loading
Loading