-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Producing a default value from a do/try/catch block combination fails #18855
Comments
|
There's also some discussion on reddit |
|
The extra statement doesn't have to be a |
|
Indeed; any statement is sufficient to upset it: I suspect this is |
|
Also, inserting my $ret = do {
try {
die "Oopsie"
} catch($e) {
do {
my $x = 123;
"result"
}
}
}; |
|
The problem seems to be when block_end on an op_scope() when op_scope() returns a block wrapped with an ENTER/LEAVE pair: The first op will be a LEAVE, block_end will call scalarseq() on it, which will do: Which puts the ENTER into void context, and we get no return. I'm not sure what the right fix is though. If we do this, things seem to work: Is it right? shrug |
|
Indeed. According to I wonder if this is actually a bug in |
|
This bugfix ought to be considered for 5.34.1. How do I record that fact? |
|
Shouldn't there be a label for that? Or an issue linking to other issues? |
|
Label added to the PR #18888 |
Description
Even when following the exact code from the 5.34 perlsyn docs regarding producing a default value with a try/catch block wrapped in a "do" block, the code fails to produce the value.
Steps to Reproduce
Expected behavior
It outputs:
It should output:
EDIT: If you remove/comment the
warnline, it works as expected.Perl configuration
The text was updated successfully, but these errors were encountered: