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++/105452] [10/11/12/13 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
Date: Thu, 30 Mar 2023 22:26:12 +0000	[thread overview]
Message-ID: <bug-105452-4-25EQyfibk4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105452-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:58df5350753c00f140c86e60ba5ce0cac686ec4b

commit r13-6949-g58df5350753c00f140c86e60ba5ce0cac686ec4b
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Mar 29 23:27:38 2023 -0400

    c++: anonymous union member reference [PR105452]

    While parsing the anonymous union, we don't yet know that it's an anonymous
    union, so we build the reference to 'v' in the static_assert relative to
the
    union type.  But at instantiation time we know it's an anonymous union, so
    we need to avoid trying to check access for 'v' in the union again; the
    simplest approach seemed to be to make accessible_p step out to the
    containing class.

    While looking at this I also noticed that we were having trouble with DMI
in
    an anonymous union referring to members of the containing class; there
    we just need to give current_class_ptr the right type.

            PR c++/105452

    gcc/cp/ChangeLog:

            * search.cc (type_context_for_name_lookup): New.
            (accessible_p): Handle anonymous union.
            * init.cc (maybe_instantiate_nsdmi_init): Use
            type_context_for_name_lookup.
            * parser.cc (cp_parser_class_specifier): Likewise.
            * cp-tree.h (type_context_for_name_lookup): Declare.

    gcc/testsuite/ChangeLog:

            * g++.dg/lookup/anon8.C: New test.

  parent reply	other threads:[~2023-03-30 22:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: " foobarandfoo at gmail dot com
2022-05-03  8:39 ` [Bug c++/105452] " marxin at gcc dot gnu.org
2022-05-03  8:47 ` [Bug c++/105452] [9/10/11/12/13 Regression] static_assert inside anonymous union inside a templated struct causes " pinskia at gcc dot gnu.org
2022-05-03 13:17 ` ppalka at gcc dot gnu.org
2022-05-27  9:48 ` [Bug c++/105452] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:49 ` jakub at gcc dot gnu.org
2022-07-26 11:37 ` rguenth at gcc dot gnu.org
2023-03-30  3:14 ` jason at gcc dot gnu.org
2023-03-30 22:26 ` cvs-commit at gcc dot gnu.org [this message]
2023-07-07 10:43 ` [Bug c++/105452] [11/12/13/14 " 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-105452-4-25EQyfibk4@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).