public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++: Diagnose [basic.scope.block]/2 violations even in compound-stmt of function-try-block [PR52953]
Date: Thu, 31 Aug 2023 15:52:22 -0400	[thread overview]
Message-ID: <a10f3b86-28be-6b42-f0d1-128fb8b18707@redhat.com> (raw)
In-Reply-To: <ZPA/L5yBEUC3WZxu@tucnak>

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  <jakub@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	other threads:[~2023-08-31 19:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31  7:20 Jakub Jelinek
2023-08-31 19:52 ` Jason Merrill [this message]
2023-09-01 13:24   ` [PATCH] c++, v2: " Jakub Jelinek
2023-09-01 14:34     ` [PATCH] c++, v3: " Jakub Jelinek
2023-09-05 14:15     ` [PATCH] c++, v2: " Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a10f3b86-28be-6b42-f0d1-128fb8b18707@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).