diff --git a/pod/perldiag.pod b/pod/perldiag.pod index aa605f04adc3..870e923b12a8 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -7664,7 +7664,7 @@ repeatedly, the C has no effect. =item Use of "goto" to jump into a construct is deprecated (D deprecated::goto_construct) Using C to jump from an outer scope into an inner -scope is deprecated and should be avoided. +scope is deprecated and will be removed completely in Perl 5.42. This was deprecated in Perl 5.12. diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 651dad1c53e4..11b0955a0a4a 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -3633,8 +3633,8 @@ block. In general, it may not be used to jump into the parameter of a binary or list operator, but it may be used to jump into the I parameter of a binary operator. (The C<=> assignment operator's "first" operand is its right-hand -operand.) It also can't be used to go into a -construct that is optimized away. +operand.) It also can't be used to go into a construct that is optimized +away. Finally, it will be made into a fatal exception in Perl 5.42. The C form is quite different from the other forms of L|/goto LABEL>. In fact, it isn't a goto in the normal sense at diff --git a/pp_ctl.c b/pp_ctl.c index a509206a0822..d3b3f178098d 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3552,7 +3552,9 @@ PP(pp_goto) ? 2 : 1; if (enterops[i]) - deprecate(WARN_DEPRECATED__GOTO_CONSTRUCT, "Use of \"goto\" to jump into a construct"); + deprecate_fatal_in(WARN_DEPRECATED__GOTO_CONSTRUCT, + "5.42", + "Use of \"goto\" to jump into a construct"); } /* pop unwanted frames */ diff --git a/t/op/goto.t b/t/op/goto.t index 592f55bbec30..c2a16fe7d1b1 100644 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -16,7 +16,13 @@ plan tests => 134; our $TODO; my $deprecated = 0; -local $SIG{__WARN__} = sub { if ($_[0] =~ m/jump into a construct/) { $deprecated++; } else { warn $_[0] } }; + +local $SIG{__WARN__} = sub { + if ($_[0] =~ m/jump into a construct.*?, and will become fatal in Perl 5\.42/) { + $deprecated++; + } + else { warn $_[0] } +}; our $foo; while ($?) { diff --git a/t/porting/deprecation.t b/t/porting/deprecation.t index 109818fe6f51..67f759e5c6c1 100644 --- a/t/porting/deprecation.t +++ b/t/porting/deprecation.t @@ -103,7 +103,7 @@ if (-e ".git") { goto LABEL; DONE: like($warning, - qr/Use of "goto" to jump into a construct is deprecated/, + qr/Use of "goto" to jump into a construct is deprecated, and will become fatal in Perl 5\.42/, "Got expected deprecation warning"); } # Test that we can silence deprecation warnings with "no warnings 'deprecated'"