c++: -Wunused-value and array init [PR104702]
authorJason Merrill <jason@redhat.com>
Wed, 6 Apr 2022 14:59:40 +0000 (10:59 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 6 Apr 2022 15:33:31 +0000 (11:33 -0400)
commitcc76c502a761ddaee215bcbd8fe4720e46d3b9dd
treefe7c31789c257c90b6bb7905a9694ff495d19115
parenteac5c12c1838d51bf05bd6f30f3f5d7bb760e398
c++: -Wunused-value and array init [PR104702]

Here, because of problems with the new warning-control code and expressions
that change location, the suppress_warning on the INDIRECT_REF didn't work.
Those problems still need to be worked out, but it's simple to avoid needing
to use suppress_warning in the first place by using a reference instead.

PR c++/104702

gcc/cp/ChangeLog:

* init.cc (build_vec_init): Use a reference for the result.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wunused-19.C: New test.
gcc/cp/init.cc
gcc/testsuite/g++.dg/warn/Wunused-19.C [new file with mode: 0644]