You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bad diagnostic for 'catch (my $e)': Can't redeclare "my" in "our" #23222
If you try to explicitly declare the exception variable of a catch block, you get a nonsensical error: Can't redeclare "my" in "our" at -e line 1, near "(my"
But there is no our declaration to be seen.
Steps to Reproduce
$ ./perl -Ilib -e 'use feature qw(try); try {} catch (my $e) {}'
Can't redeclare "my" in "our" at -e line 1, near "(my"
syntax error at -e line 1, near "(my "
Execution of -e aborted due to compilation errors.
Expected behavior
$ ./perl -Ilib -e 'use feature qw(try); try {} catch (my $e) {}'
syntax error at -e line 1, near "(my "
Execution of -e aborted due to compilation errors.
Or maybe something better than just syntax error. The point is, Can't redeclare ... shouldn't be there because there is no our (my $e) in the code.
Perl configuration
... shouldn't really matter. I get the same output from perl 5.34.1, 5.36.0, 5.38.2, 5.40.2, and blead @ 6c95af2.
Activity
toke.c: explicitly diagnose 'catch (my $e)'
toke.c: explicitly diagnose 'catch (my $e)'
toke.c: explicitly diagnose 'catch (my $e)'
toke.c: explicitly diagnose 'catch (my $e)'
toke.c: explicitly diagnose 'catch (my $e)'