]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: drop in-charge for dtors without vbases
authorJason Merrill <jason@redhat.com>
Tue, 12 Dec 2023 23:07:28 +0000 (18:07 -0500)
committerJason Merrill <jason@redhat.com>
Wed, 1 May 2024 18:59:26 +0000 (14:59 -0400)
commita12cae973900f118436ef85c1197e91bf0428280
tree77887bf5d629fa2afe7305845640bcbb8a61d216
parent76ca6e1f8b1524b82a871ce29cf58c79e5e77e2b
c++: drop in-charge for dtors without vbases

Constructors and destructors use the in-charge parameter to decide whether
they're responsible for recursing into virtual bases.  Historically all
destructors had this parameter in order to also distinguish the deleting
destructor.  But r151673 in GCC 4.5 changed the deleting destructor to just
call the complete destructor and then operator delete, making the in-charge
parameter no longer relevant for destructors in classes without virtual
bases.  Having it causes confusion in constexpr evaluation, which assumes
that clones will have the same parameters as the cloned 'tor.

gcc/cp/ChangeLog:

* cp-tree.h (base_ctor_identifier): Adjust comment.
* call.cc (in_charge_arg_for_name): Abort on deleting dtor.
* decl2.cc (maybe_retrofit_in_chrg): Don't add it for
destructors without vbases, either.
* constexpr.cc (cxx_eval_call_expression): Remove workaround.

gcc/testsuite/ChangeLog:

* g++.dg/debug/dwarf2/array-3.C: No more 'int' for in-chrg parm.
* g++.dg/debug/dwarf2/array-4.C: Likewise.
gcc/cp/call.cc
gcc/cp/constexpr.cc
gcc/cp/cp-tree.h
gcc/cp/decl2.cc
gcc/testsuite/g++.dg/debug/dwarf2/array-3.C
gcc/testsuite/g++.dg/debug/dwarf2/array-4.C