or define F<PERL_ENV_TABLES> (see L<perlvms>) so that environ is not
searched.
+=item Can't redeclare "%s" in "%s"
+
+(F) A "my", "our" or "state" declaration was found within another declaration,
+such as C<my ($x, my($y), $z)> or C<our (my $x)>.
+
=item Can't "redo" outside a loop block
(F) A "redo" statement was executed to restart the current block, but
<<"foo
EXPECT
Unterminated delimiter for here document at - line 1.
+########
+# NAME my (our $x) errors
+my (our $x);
+EXPECT
+Can't redeclare "our" in "my" at - line 1, at end of line
+Execution of - aborted due to compilation errors.
+########
+# NAME our (my $x) errors
+our (my $x);
+EXPECT
+Can't redeclare "my" in "our" at - line 1, at end of line
+Execution of - aborted due to compilation errors.
+########
+# NAME state (my $x) errors
+use feature 'state';
+state (my $x);
+EXPECT
+Can't redeclare "my" in "state" at - line 2, at end of line
+Execution of - aborted due to compilation errors.
+########
+# NAME our (state $x) errors
+use feature 'state';
+our (state $x);
+EXPECT
+Can't redeclare "state" in "our" at - line 2, at end of line
+Execution of - aborted due to compilation errors.
+########
+# NAME my (my $x) errors
+my (my $x, $y, $z);
+EXPECT
+Can't redeclare "my" in "my" at - line 1, at end of line
+Execution of - aborted due to compilation errors.
+########
+# NAME our (our $x) errors
+our ($x, our($y), $z);
+EXPECT
+Can't redeclare "our" in "our" at - line 1, near ", "
+Execution of - aborted due to compilation errors.
+########
+# NAME state (state $x) errors
+use feature 'state';
+state ($x, $y, state $z);
+EXPECT
+Can't redeclare "state" in "state" at - line 2, near ", "
+Execution of - aborted due to compilation errors.
is($cs, 2, 'overload string called twice');
}
-fresh_perl_is('sub w ($$) {my ($l, my $r) = @_; my $v = \@_; undef @_; $l <=> $r}; print join q{ }, sort w 3, 1, 2, 0',
+fresh_perl_is('sub w ($$) {my ($l, $r) = @_; my $v = \@_; undef @_; $l <=> $r}; print join q{ }, sort w 3, 1, 2, 0',
'0 1 2 3',
{stderr => 1, switches => ['-w']},
'RT #72334');
-fresh_perl_is('sub w ($$) {my ($l, my $r) = @_; my $v = \@_; undef @_; @_ = 0..2; $l <=> $r}; print join q{ }, sort w 3, 1, 2, 0',
+fresh_perl_is('sub w ($$) {my ($l, $r) = @_; my $v = \@_; undef @_; @_ = 0..2; $l <=> $r}; print join q{ }, sort w 3, 1, 2, 0',
'0 1 2 3',
{stderr => 1, switches => ['-w']},
'RT #72334');
case KEY_our:
case KEY_my:
case KEY_state:
+ if (PL_in_my) {
+ yyerror(Perl_form(aTHX_
+ "Can't redeclare \"%s\" in \"%s\"",
+ tmp == KEY_my ? "my" :
+ tmp == KEY_state ? "state" : "our",
+ PL_in_my == KEY_my ? "my" :
+ PL_in_my == KEY_state ? "state" : "our"));
+ }
PL_in_my = (U16)tmp;
s = skipspace(s);
if (isIDFIRST_lazy_if(s,UTF)) {