[Bug c++/104142] [9/10 Regression] Spurious warning unused-variable on const static variable and defaulted constructor

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 12 21:25:12 GMT 2022


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
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:cfa3a04be981f63af41f9a960df06e84c2634c5f

commit r10-10729-gcfa3a04be981f63af41f9a960df06e84c2634c5f
Author: Jason Merrill <jason@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.


More information about the Gcc-bugs mailing list