c++: check delete access with trivial init [PR20040]
authorJason Merrill <jason@redhat.com>
Thu, 6 Jan 2022 21:13:04 +0000 (16:13 -0500)
committerJason Merrill <jason@redhat.com>
Fri, 7 Jan 2022 22:11:56 +0000 (17:11 -0500)
commit6cd51207f5732b5258e883e9030b94c987b6d696
treeed273fb8060d19c9175856c892efb20bea769f7f
parent997130f778c56466a825627644e510960585521b
c++: check delete access with trivial init [PR20040]

Apparently we need to check the accessibility of the deallocation function
even if there is no initialization.

PR c++/20040

gcc/cp/ChangeLog:

* init.c (build_new_1): Also build pointer cleanup if
TYPE_GETS_DELETE.
* cp-tree.h (TYPE_GETS_VEC_DELETE): New.

gcc/testsuite/ChangeLog:

* g++.dg/init/delete4.C: New test.
gcc/cp/cp-tree.h
gcc/cp/init.c
gcc/testsuite/g++.dg/init/delete4.C [new file with mode: 0644]