]> gcc.gnu.org Git - gcc.git/commit
c++: block copy elision in delegating ctor
authorJason Merrill <jason@redhat.com>
Wed, 24 Aug 2022 20:28:32 +0000 (16:28 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 25 Aug 2022 21:03:10 +0000 (17:03 -0400)
commit072d3115c0e297d91c133c4214b357b0a50557b9
tree56aee593ee7bddd43a1bb5437d74dd52235fc1ea
parent30e160475489867a09ed89532cae135b5849cf98
c++: block copy elision in delegating ctor

CWG2403 deals with the issue that copy elision is not possible when the
initialized object is a potentially-overlapping subobject and the
initializer is a function that returns by value.  Jonathan pointed out that
this also affects delegating constructors, which might be used to construct
a base subobject.

gcc/cp/ChangeLog:

* call.cc (unsafe_return_slot_p): Return 2 for *this in a
constructor.

gcc/testsuite/ChangeLog:

* g++.dg/init/elide8.C: New test.
gcc/cp/call.cc
gcc/testsuite/g++.dg/init/elide8.C [new file with mode: 0644]
This page took 0.065009 seconds and 5 git commands to generate.