diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-07-02 22:08:45 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-07-02 22:08:45 +0200 |
commit | beb7a418aaef2ec8a812712110b007c091a73491 (patch) | |
tree | 088bc7eefe435ab66e20bc74bb34fe987f72a559 /gcc/tree-pass.h | |
parent | f30bdb1f2d79fd787e0c270039179bf80830161f (diff) | |
download | gcc-beb7a418aaef2ec8a812712110b007c091a73491.zip gcc-beb7a418aaef2ec8a812712110b007c091a73491.tar.gz gcc-beb7a418aaef2ec8a812712110b007c091a73491.tar.bz2 |
c++: Implement C++26 P3144R2 - Deleting a Pointer to an Incomplete Type Should be Ill-formed [PR115747]
The following patch implements the C++26 paper which makes delete
and delete[] on incomplete class types invalid, previously it has
been UB unless the class had trivial destructor and no custom
deallocator.
The patch uses permerror_opt, so -Wno-delete-incomplete makes it
still compile without warnings like before, and -fpermissive makes
it warn but not error; in SFINAE contexts it is considered an error
in C++26 and later.
2024-07-02 Jakub Jelinek <jakub@redhat.com>
Jason Merrill <jason@redhat.com>
PR c++/115747
gcc/cp/
* init.cc: Implement C++26 P3144R2 - Deleting a Pointer to an
Incomplete Type Should be Ill-formed.
(build_vec_delete_1): Emit permerror_at and return error_mark_node
for delete [] on incomplete type.
(build_delete): Similarly for delete.
gcc/testsuite/
* g++.dg/init/delete1.C: Adjust expected diagnostics for C++26.
* g++.dg/warn/Wdelete-incomplete-1.C: Likewise.
* g++.dg/warn/incomplete1.C: Likewise.
* g++.dg/ipa/pr85607.C: Likewise.
* g++.dg/cpp26/delete1.C: New test.
* g++.dg/cpp26/delete2.C: New test.
* g++.dg/cpp26/delete3.C: New test.
Diffstat (limited to 'gcc/tree-pass.h')
0 files changed, 0 insertions, 0 deletions