]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: cleanup constant-init'd members [PR96876]
authorJason Merrill <jason@redhat.com>
Fri, 4 Feb 2022 23:25:51 +0000 (18:25 -0500)
committerJason Merrill <jason@redhat.com>
Wed, 9 Feb 2022 01:09:55 +0000 (20:09 -0500)
commit53cac72cf0821217f99d0640ba72cc2999ec7dc0
tree39afa87017a50078ed99e8bb01e7e247b317246f
parent2a2fda2d9bebb9ef7fe4b9c8aa492a6517603e21
c++: cleanup constant-init'd members [PR96876]

This is a case missed by my recent fixes to aggregate initialization and
exception cleanup for PR94041 et al: we also need to clean up members with
constant initialization if initialization of a later member throws.

It also occurs to me that we needn't bother building the cleanups if
-fno-exceptions; build_vec_init already doesn't.

PR c++/96876

gcc/cp/ChangeLog:

* typeck2.cc (split_nonconstant_init_1): Push cleanups for
preceding members with constant initialization.
(maybe_push_temp_cleanup): Do nothing if -fno-exceptions.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/aggr-base11.C: New test.
* g++.dg/eh/aggregate2.C: New test.
gcc/cp/typeck2.cc
gcc/testsuite/g++.dg/cpp1z/aggr-base11.C [new file with mode: 0644]
gcc/testsuite/g++.dg/eh/aggregate2.C [new file with mode: 0644]