On 8/31/23 03:20, Jakub Jelinek wrote:
Hi!

As the following testcase shows, while check_local_shadow diagnoses most of
the [basic.scope.block]/2 violations, it doesn't diagnose when parameter's
name is redeclared inside of the compound-stmt of a function-try-block.

There is in that case an extra scope (sk_try with parent artificial
sk_block with for FUNCTION_NEEDS_BODY_BLOCK another sk_block and only then
sk_function_param).

The following patch fixes that.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2023-08-31  Jakub Jelinek  <ja...@redhat.com>

        PR c++/52953
        * cp-tree.h (struct language_function): Add x_in_function_try_block
        member.

How about adding a flag to cp_binding_level instead? Maybe to mark the artificial sk_block level as such, which we could use for both this case and the FUNCTION_NEEDS_BODY_BLOCK cases.

Jason

Reply via email to