* [Bug c++/105452] static_assert inside nameless nested union: invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error foobarandfoo at gmail dot com
@ 2022-05-03 8:39 ` 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
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-05-03 8:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105452
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-05-03
CC| |marxin at gcc dot gnu.org,
| |redi at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/105452] [9/10/11/12/13 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error foobarandfoo at gmail dot com
2022-05-03 8:39 ` [Bug c++/105452] " marxin at gcc dot gnu.org
@ 2022-05-03 8:47 ` pinskia at gcc dot gnu.org
2022-05-03 13:17 ` ppalka at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-05-03 8:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105452
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |9.5
Known to work| |4.4.7, 4.7.1
Summary|static_assert inside |[9/10/11/12/13 Regression]
|anonymous union inside a |static_assert inside
|templated struct causes |anonymous union inside a
|invalid "inaccessible |templated struct causes
|within this context" error |invalid "inaccessible
| |within this context" error
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/105452] [9/10/11/12/13 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error 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
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-05-03 13:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105452
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r0-118596-g2c905502202e55
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/105452] [10/11/12/13 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error foobarandfoo at gmail dot com
` (2 preceding siblings ...)
2022-05-03 13:17 ` ppalka at gcc dot gnu.org
@ 2022-05-27 9:48 ` rguenth at gcc dot gnu.org
2022-06-28 10:49 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 9:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105452
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.5 |10.4
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/105452] [10/11/12/13 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error foobarandfoo at gmail dot com
` (3 preceding siblings ...)
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
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105452
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/105452] [10/11/12/13 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error foobarandfoo at gmail dot com
` (4 preceding siblings ...)
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
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-26 11:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105452
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/105452] [10/11/12/13 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error foobarandfoo at gmail dot com
` (5 preceding siblings ...)
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
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-30 3:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105452
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
If v is dependent, the testcase last worked in 4.5.
template <typename T>
struct C {
union {
T v;
static_assert(sizeof(v) == sizeof(char), "");
};
};
int main() {
C<char> x;
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/105452] [10/11/12/13 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error foobarandfoo at gmail dot com
` (6 preceding siblings ...)
2023-03-30 3:14 ` jason at gcc dot gnu.org
@ 2023-03-30 22:26 ` cvs-commit at gcc dot gnu.org
2023-07-07 10:43 ` [Bug c++/105452] [11/12/13/14 " rguenth at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-30 22:26 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/105452] [11/12/13/14 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error foobarandfoo at gmail dot com
` (7 preceding siblings ...)
2023-03-30 22:26 ` cvs-commit at gcc dot gnu.org
@ 2023-07-07 10:43 ` rguenth at gcc dot gnu.org
2024-07-19 13:16 ` [Bug c++/105452] [12/13/14/15 " rguenth at gcc dot gnu.org
2024-07-24 14:18 ` jason at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105452
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/105452] [12/13/14/15 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error foobarandfoo at gmail dot com
` (8 preceding siblings ...)
2023-07-07 10:43 ` [Bug c++/105452] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-07-19 13:16 ` rguenth at gcc dot gnu.org
2024-07-24 14:18 ` jason at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-07-19 13:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105452
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.5 |12.5
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11 branch is being closed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/105452] [12/13/14/15 Regression] static_assert inside anonymous union inside a templated struct causes invalid "inaccessible within this context" error
2022-05-02 11:27 [Bug c++/105452] New: static_assert inside nameless nested union: invalid "inaccessible within this context" error foobarandfoo at gmail dot com
` (9 preceding siblings ...)
2024-07-19 13:16 ` [Bug c++/105452] [12/13/14/15 " rguenth at gcc dot gnu.org
@ 2024-07-24 14:18 ` jason at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2024-07-24 14:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105452
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.5 |13.0
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed in GCC 13.
^ permalink raw reply [flat|nested] 12+ messages in thread