https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104142
--- Comment #9 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:cfa3a04be981f63af41f9a960df06e84c2634c5f commit r10-10729-gcfa3a04be981f63af41f9a960df06e84c2634c5f Author: Jason Merrill <ja...@redhat.com> Date: Mon Apr 11 14:50:14 2022 -0400 c++: rodata and defaulted ctor [PR104142] Trivial initialization shouldn't bump a variable out of .rodata; if the result of build_aggr_init is an empty STATEMENT_LIST, throw it away. PR c++/104142 gcc/cp/ChangeLog: * decl.c (check_initializer): Check TREE_SIDE_EFFECTS. gcc/testsuite/ChangeLog: * g++.dg/opt/const7.C: New test.