https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121228
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This might work: ``` [apinski@xeond2 cp]$ git diff decl.cc diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 0ac92f84b0e..9fc57e59764 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -9654,7 +9654,7 @@ find_decomp_class_base (location_t loc, tree type, tree ret) inform (DECL_SOURCE_LOCATION (field), "declared here"); return error_mark_node; } - else if (!accessible_p (type, field, true)) + else if (flag_access_control && !accessible_p (type, field, true)) { auto_diagnostic_group d; error_at (loc, "cannot decompose inaccessible member %qD of %qT", ``` Or it might cause other issues.