From Mikhail Maltsev's comment 5 on Bug #65154: But it reveals some latent bug (PR65503). In the following case (after applying the patch): struct ss { ss() {}; }; struct C { ss s[1000]; }; int main() { C cs[5]{}; } We'll get 1000 calls to ss() in main instead of calling default c-tor of struct C. (which is probably not what we want). ----- I agree that we want to call the default constructor in this case, and let the inliner decide from there. This is not the same issue as bug 65503.
Confirmed.
Actually, the standard (8.5.1/8.5.4) says we need to do aggregate initialization here, so this is either a language issue or a duplicate of bug 65503.
We should be able to do a loop instead of 1000 calls though.
Note I thought the patch which fixes PR 92385 would fix this one but instead we are getting an ICE which I filed as PR 103936. I suspect after that is fixed this will also be fixed.
Yes, this is fixed by r12-6326. And then broken again by r12-6329, which I'll address in the new PR. *** This bug has been marked as a duplicate of bug 92385 ***
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:765693be1c8dc91fe612e7a499c5e41ba398ab96 commit r12-6339-g765693be1c8dc91fe612e7a499c5e41ba398ab96 Author: Jason Merrill <jason@redhat.com> Date: Thu Jan 6 21:58:01 2022 -0500 c++: temporarily restore VEC_INIT_EXPR gimplify [PR103936] PR103936 demonstrates that some VEC_INIT_EXPR can still survive into GENERIC; until that's fixed let's put back the handling in cp_gimplify_expr. PR c++/103936 PR c++/65591 gcc/cp/ChangeLog: * cp-gimplify.c (cp_gimplify_expr): Restore VEC_INIT_EXPR handling. gcc/testsuite/ChangeLog: * g++.dg/init/aggr15.C: New test.