c++: class array new checking [PR104084]
authorJason Merrill <jason@redhat.com>
Fri, 21 Jan 2022 17:49:03 +0000 (12:49 -0500)
committerJason Merrill <jason@redhat.com>
Fri, 21 Jan 2022 19:40:09 +0000 (14:40 -0500)
commit847a8301add0a316767878342c1367948835c181
tree493d8dfff742fd81b3af794d6c569b61b72f6f0b
parentc163647ffbc9a20c8feb6e079dbecccfe016c82e
c++: class array new checking [PR104084]

My patch for PR20040 made us stop exiting early from build_new_1 in
cases of trivial initialization if there's a class operator delete; as a
result, code later in the function needs to handle this case properly.

PR c++/104084
PR c++/20040

gcc/cp/ChangeLog:

* init.cc (build_new_1): Only pull out TARGET_EXPR_INITIAL if
alloc_expr is a TARGET_EXPR.

gcc/testsuite/ChangeLog:

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