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

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 12 03:58:26 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104142

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:0899b22d9329c1e8fc12d6f0deee0f87dcc0163a

commit r12-8099-g0899b22d9329c1e8fc12d6f0deee0f87dcc0163a
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.cc (check_initializer): Check TREE_SIDE_EFFECTS.

    gcc/testsuite/ChangeLog:

            * g++.dg/opt/const7.C: New test.


More information about the Gcc-bugs mailing list