public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>,
	Nathan Sidwell <nathan@acm.org>
Subject: Re: [PATCH] [PR86823] retain deferred access checks from outside firewall
Date: Fri, 14 Dec 2018 14:32:00 -0000	[thread overview]
Message-ID: <CADzB+2mWyTPqhQAOq4X69gd9Y6JizORkJ=4mVWhefApzRzQ65w@mail.gmail.com> (raw)
In-Reply-To: <orva3wevpz.fsf@lxoliva.fsfla.org>

OK.
On Thu, Dec 13, 2018 at 8:35 PM Alexandre Oliva <aoliva@redhat.com> wrote:
>
> On Dec  6, 2018, Alexandre Oliva <aoliva@redhat.com> wrote:
>
> > I'm giving your proposed patch a full round of testing along with other
> > patches.
>
> [PR86823] retain deferred access checks from outside firewall
>
> We used to preserve deferred access check along with resolved template
> ids, but a tentative parsing firewall introduced additional layers of
> deferred access checks, so that we don't preserve the checks we
> want to any more.
>
> This patch moves the deferred access checks from outside the firewall
> into it.
>
> Regstrapped on x86_64- and i686-linux-gnu.  Ok to install?
>
>
> From: Jason Merrill <jason@redhat.com>
> for  gcc/cp/ChangeLog
>
>         PR c++/86823
>         * parser.c (cp_parser_template_id): Rearrange deferred access
>         checks into the firewall.
>
> From: Alexandre Oliva <aoliva@redhat.com>
> for  gcc/testsuite/ChangeLog
>
>         PR c++/86823
>         * g++.dg/pr86823.C: New.
> ---
>  gcc/cp/parser.c                |   10 ++++++----
>  gcc/testsuite/g++.dg/pr86823.C |   15 +++++++++++++++
>  2 files changed, 21 insertions(+), 4 deletions(-)
>  create mode 100644 gcc/testsuite/g++.dg/pr86823.C
>
> diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
> index adfe09e494dc..0bf0e309a588 100644
> --- a/gcc/cp/parser.c
> +++ b/gcc/cp/parser.c
> @@ -16182,16 +16182,18 @@ cp_parser_template_id (cp_parser *parser,
>                                    is_declaration,
>                                    tag_type,
>                                    &is_identifier);
> +
> +  /* Push any access checks inside the firewall we're about to create.  */
> +  vec<deferred_access_check, va_gc> *checks = get_deferred_access_checks ();
> +  pop_deferring_access_checks ();
>    if (templ == error_mark_node || is_identifier)
> -    {
> -      pop_deferring_access_checks ();
> -      return templ;
> -    }
> +    return templ;
>
>    /* Since we're going to preserve any side-effects from this parse, set up a
>       firewall to protect our callers from cp_parser_commit_to_tentative_parse
>       in the template arguments.  */
>    tentative_firewall firewall (parser);
> +  reopen_deferring_access_checks (checks);
>
>    /* If we find the sequence `[:' after a template-name, it's probably
>       a digraph-typo for `< ::'. Substitute the tokens and check if we can
> diff --git a/gcc/testsuite/g++.dg/pr86823.C b/gcc/testsuite/g++.dg/pr86823.C
> new file mode 100644
> index 000000000000..18914b00aa8d
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/pr86823.C
> @@ -0,0 +1,15 @@
> +// { dg-do compile }
> +
> +struct X {
> +private:
> +  template<typename T>
> +  struct Y {
> +    int data;
> +  };
> +public:
> +  int value;
> +};
> +
> +int main() {
> +  typename X::Y<int> a; // { dg-error "private" }
> +}
>
>
> --
> Alexandre Oliva, freedom fighter   https://FSFLA.org/blogs/lxo
> Be the change, be Free!         FSF Latin America board member
> GNU Toolchain Engineer                Free Software Evangelist
> Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe

      reply	other threads:[~2018-12-14 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-17  2:16 Alexandre Oliva
2018-12-06  1:10 ` Jason Merrill
2018-12-06 23:38   ` Alexandre Oliva
2018-12-14  2:34     ` Alexandre Oliva
2018-12-14 14:32       ` Jason Merrill [this message]

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='CADzB+2mWyTPqhQAOq4X69gd9Y6JizORkJ=4mVWhefApzRzQ65w@mail.gmail.com' \
    --to=jason@redhat.com \
    --cc=aoliva@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nathan@acm.org \
    /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).