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++/100918] [9/10/11/12 Regression] Naming a destructor as a qualified template-id results in bogus access error Date: Tue, 13 Jul 2021 14:03:12 +0000 [thread overview] Message-ID: <bug-100918-4-KrcbXuYhXS@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100918-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100918 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:6530cf0d50ae4c23c8e1ba908d1d0d4472e2966c commit r11-8727-g6530cf0d50ae4c23c8e1ba908d1d0d4472e2966c Author: Patrick Palka <ppalka@redhat.com> Date: Mon Jun 7 12:02:08 2021 -0400 c++: access of dtor named by qualified template-id [PR100918] Here, when resolving the destructor named by Inner<int>::~Inner<int> (which is valid until C++20) we end up in cp_parser_lookup_name called indirectly from cp_parser_template_id to look up the name Inner from the scope Inner<int>. The lookup naturally finds the injected-class-name, and because the flag is_template is true, we adjust this lookup result to the TEMPLATE_DECL Inner. We then check access of this adjusted lookup result. But this access check fails because the lookup scope is Inner<int> and the context_for_name_lookup for the TEMPLATE_DECL is Outer (whereas for the injected-class-name it's also Inner<int>). The simplest fix seems to be to check access of the original lookup result (the injected-class-name) instead of the adjusted result (the TEMPLATE_DECL). So this patch moves the access check in cp_parser_lookup_name to before the injected-class-name adjustment. PR c++/100918 gcc/cp/ChangeLog: * parser.c (cp_parser_lookup_name): Check access of the lookup result before we potentially adjust an injected-class-name to its TEMPLATE_DECL. gcc/testsuite/ChangeLog: * g++.dg/template/access38.C: New test. (cherry picked from commit 6cb35b606c39d5f21f3298c77bfbcaaef3fbc872)
next prev parent reply other threads:[~2021-07-13 14:03 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-04 20:22 [Bug c++/100918] New: " ppalka at gcc dot gnu.org 2021-06-04 20:27 ` [Bug c++/100918] " ppalka at gcc dot gnu.org 2021-06-04 20:33 ` ppalka at gcc dot gnu.org 2021-06-04 21:12 ` [Bug c++/100918] [9/10/11/12 Regression] " ppalka at gcc dot gnu.org 2021-06-07 16:06 ` cvs-commit at gcc dot gnu.org 2021-07-13 14:03 ` cvs-commit at gcc dot gnu.org [this message] 2021-07-13 14:04 ` [Bug c++/100918] [9/10 " ppalka at gcc dot gnu.org 2022-05-27 9:45 ` [Bug c++/100918] [10 " rguenth at gcc dot gnu.org 2022-06-28 10:45 ` jakub at gcc dot gnu.org 2023-05-04 21:43 ` christian.prochaska@genode-labs.com 2023-05-04 21:46 ` pinskia at gcc dot gnu.org 2023-05-04 21:49 ` pinskia at gcc dot gnu.org 2023-07-07 9:41 ` rguenth 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-100918-4-KrcbXuYhXS@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: linkBe 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).