]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: missing dtor with -fno-elide-constructors [PR100838]
authorJason Merrill <jason@redhat.com>
Mon, 31 May 2021 16:36:25 +0000 (12:36 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 13 May 2022 18:02:01 +0000 (14:02 -0400)
commit200d477d3cb1593dbaa7739c6270e0a7f6c564cf
tree83aaa7b30a91b2a1b2f24a60b082aa8d1e12def1
parentda999d938e516ff12b39a0aa7e8f6d97fbee60df
c++: missing dtor with -fno-elide-constructors [PR100838]

tf_no_cleanup only applies to the outermost TARGET_EXPR, and we already
clear it for nested calls in build_over_call, but in this case both
constructor calls came from convert_like, so we need to clear it in the
recursive call as well.  This revealed that we were adding an extra
ck_rvalue in direct-initialization cases where it was wrong.

PR c++/100838
PR c++/105265

gcc/cp/ChangeLog:

* call.c (convert_like_internal): Clear tf_no_cleanup when
recursing.
(build_user_type_conversion_1): Only add ck_rvalue if
LOOKUP_ONLYCONVERTING.

gcc/testsuite/ChangeLog:

* g++.dg/init/no-elide2.C: New test.
* g++.dg/cpp0x/initlist-new6.C: New test.
gcc/cp/call.c
gcc/testsuite/g++.dg/cpp0x/initlist-new6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/init/no-elide2.C [new file with mode: 0644]