mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
c++/reflection: fix ICE on is_accessible [PR124241]
Anonymous unions don't have their own access. This patch fix the missing check for otype in accessible_p at search.cc. gcc/cp/ChangeLog: PR c++/124241 * search.cc (accessible_p): Call type_context_for_name_lookup for otype if it's anonymous union. gcc/testsuite/ChangeLog: PR c++/124241 * g++.dg/reflect/is_accessible2.C: Completed the TODO of the PR. Reviewed-by: Jason Merrill <jason@redhat.com>
This commit is contained in:
committed by
Jason Merrill
parent
3c917d8d04
commit
822c784092
@@ -936,6 +936,8 @@ accessible_p (tree type, tree decl, bool consider_local_p)
|
||||
/* Anonymous unions don't have their own access. */
|
||||
if (ANON_AGGR_TYPE_P (type))
|
||||
type = type_context_for_name_lookup (type);
|
||||
if (ANON_AGGR_TYPE_P (otype))
|
||||
otype = type_context_for_name_lookup (otype);
|
||||
|
||||
/* [class.access.base]
|
||||
|
||||
|
||||
@@ -454,8 +454,7 @@ static_assert (is_accessible (N::ra, gctx));
|
||||
static_assert (!is_accessible (N::rb, gctx));
|
||||
static_assert (!is_accessible (N::rc, gctx));
|
||||
static_assert (is_accessible (N::ra, N::ctx));
|
||||
// TODO: This case ICEs.
|
||||
//static_assert (is_accessible (N::rb, N::ctx));
|
||||
static_assert (is_accessible (N::rb, N::ctx));
|
||||
static_assert (is_accessible (N::rc, N::ctx));
|
||||
static_assert (is_accessible (N::ra, N::ctx.via (^^N)));
|
||||
static_assert (is_accessible (N::rb, N::ctx.via (^^N)));
|
||||
|
||||
Reference in New Issue
Block a user