builtin: can't "defer recover()" without an anonymous func #20768
Labels
Documentation
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
What version of Go are you using (
go version
)?go version devel +ded29e7b39 Wed Jun 21 04:56:15 2017 +0000 linux/amd64
Also on 1.8.3.
What operating system and processor architecture are you using (
go env
)?What did you do?
This works: https://play.golang.org/p/YYvq0OrB8H
This doesn't: https://play.golang.org/p/7u3lbkXkVp
What did you expect to see?
I expected the absence of an anonymous function to not change the behaviour of
defer
and/orpanic
.What did you see instead?
The opposite - the deferred
recover
doesn't do its job.Perhaps there's something I'm missing. I also don't know where this bug - if there is one - resides. Could well be the compiler, or perhaps even a spec clarification.
Note that I realise that the
defer statement
spec says:Note how
recover
isn't one of them. And if it was restricted, it should be a compile-time error, not a change in run-time behaviour.The text was updated successfully, but these errors were encountered: