https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96673
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:e206f71eaf98149224269b00407bc5def6ae2dca commit r10-9848-ge206f71eaf98149224269b00407bc5def6ae2dca Author: Jason Merrill <ja...@redhat.com> Date: Tue Apr 6 15:13:02 2021 -0400 c++: access checking in aggregate initialization [PR96673] We were deferring access checks while parsing B<int>{}, didn't adjust that when we went to instantiate the default member initializer for B::c, deferred access checking for C::C, and then checked it after parsing B<int>{}, back in the main() context which has no access. We need to do the access checks in the class context of the DMI. I tried fixing this in push_to/pop_from_top_level, but that caused several regressions. gcc/cp/ChangeLog: PR c++/96673 * init.c (get_nsdmi): Don't defer access checking. gcc/testsuite/ChangeLog: PR c++/96673 * g++.dg/cpp1y/nsdmi-aggr13.C: New test.