On 6/30/20 2:56 AM, Arjan wrote:
On Monday, 29 June 2020 at 22:47:16 UTC, Steven Schveighoffer wrote:
Yes. The return statement is inside the scope of the function, so it runs before the scope is exited. Are you saying the spec doesn't say that?

Thanks for the assurance. The spec does state it like this:
The ScopeGuardStatement executes NonEmptyOrScopeBlockStatement at the close of the current scope, rather than at the point where the ScopeGuardStatement appears.
Which is correct, but there is no single example with a return where the ScopeBlockStatement interferes with the return.

I started wondering about this since I hit a bug in a piece of code.

I can see where it would be confusing, and it could probably contain an example and clarification.


Reply via email to