public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/98515] [11 Regression] Possible regression causing "is protected within this context" error
Date: Fri, 08 Jan 2021 15:17:15 +0000	[thread overview]
Message-ID: <bug-98515-4-LexzwQqapa@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98515-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98515

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:98a1fb705ead9258642f2dec0431f11508a9b13c

commit r11-6553-g98a1fb705ead9258642f2dec0431f11508a9b13c
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Jan 8 10:02:04 2021 -0500

    c++: Fix access checking of scoped non-static member [PR98515]

    In the first testcase below, we incorrectly reject the use of the
    protected non-static member A::var0 from C<int>::g() because
    check_accessibility_of_qualified_id, at template parse time, determines
    that the access doesn't go through 'this'.  (This happens because the
    dependent base B<T> of C<T> doesn't have a binfo object, so it appears
    to DERIVED_FROM_P that A is not an indirect base of C<T>.)  From there
    we create the corresponding deferred access check, which we then
    perform at instantiation time and which (expectedly) fails.

    The problem ultimately seems to be that we can't in general determine
    whether a use of a scoped non-static member goes through 'this' until
    instantiation time, as the second testcase below illustrates.  So this
    patch makes check_accessibility_of_qualified_id punt in such situations
    to avoid creating a bogus deferred access check.

    gcc/cp/ChangeLog:

            PR c++/98515
            * semantics.c (check_accessibility_of_qualified_id): Punt if
            we're checking access of a scoped non-static member inside a
            class template.

    gcc/testsuite/ChangeLog:

            PR c++/98515
            * g++.dg/template/access32.C: New test.
            * g++.dg/template/access33.C: New test.

  parent reply	other threads:[~2021-01-08 15:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 16:49 [Bug c++/98515] New: " belegdol at gmail dot com
2021-01-04 16:50 ` [Bug c++/98515] " belegdol at gmail dot com
2021-01-04 16:50 ` belegdol at gmail dot com
2021-01-04 16:53 ` belegdol at gmail dot com
2021-01-04 20:19 ` [Bug c++/98515] [11 Regression] " mpolacek at gcc dot gnu.org
2021-01-05 18:45 ` ppalka at gcc dot gnu.org
2021-01-08 15:17 ` cvs-commit at gcc dot gnu.org [this message]
2021-01-08 15:19 ` ppalka at gcc dot gnu.org

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=bug-98515-4-LexzwQqapa@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).