aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-12-10 15:10:59 -0500
committerJason Merrill <jason@gcc.gnu.org>2019-12-10 15:10:59 -0500
commit09b661cea17a144e68009ecdf61a92a05bf852dd (patch)
tree1b9cad92725bcc9fdcbf79f2494fde214906af93 /gcc/cp/tree.c
parent1fb81d83a8857770be56df19c8a3b4e0ca87c71c (diff)
downloadgcc-09b661cea17a144e68009ecdf61a92a05bf852dd.zip
gcc-09b661cea17a144e68009ecdf61a92a05bf852dd.tar.gz
gcc-09b661cea17a144e68009ecdf61a92a05bf852dd.tar.bz2
Fix C++20 structural type vs. private base.
In my patch to implement C++20 "structural type" I tried to set the access flags on the artificial base fields appropriately, but failed. I was copying TREE_PRIVATE from the binfo, but TREE_PRIVATE on binfo is just a temporary cache for dfs_access_in_type; we really need to get the inheritance access information from BINFO_BASE_ACCESSES. * class.c (build_base_field_1): Take access parameter. (build_base_field): Likewise. (build_base_fields, layout_virtual_bases): Pass it. * tree.c (structural_type_p): Improve private base diagnostic. From-SVN: r279184
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index c7c063f..7b5a3e4 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -4447,7 +4447,13 @@ structural_type_p (tree t, bool explain)
if (TREE_PRIVATE (m) || TREE_PROTECTED (m))
{
if (explain)
- inform (location_of (m), "%qD is not public", m);
+ {
+ if (DECL_FIELD_IS_BASE (m))
+ inform (location_of (m), "base class %qT is not public",
+ TREE_TYPE (m));
+ else
+ inform (location_of (m), "%qD is not public", m);
+ }
return false;
}
if (!structural_type_p (TREE_TYPE (m)))