]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: fix contracts with NRV
authorJason Merrill <jason@redhat.com>
Tue, 6 Jun 2023 03:58:32 +0000 (23:58 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 17 Nov 2023 00:20:45 +0000 (19:20 -0500)
commit11afe64fb71c83cef7d56fe6c411fb7adeee59cb
tree11cf3c5d116e9fd81e9fb369cc6ddd0642447adb
parent65388a996d7dfcdd22ff2d191458699d1cacf254
c++: fix contracts with NRV

The NRV implementation was blindly replacing the operand of RETURN_EXPR,
clobbering anything that check_return_expr might have added on to the actual
initialization, such as checking the postcondition.

GCC 12 note: There are no contracts in GCC 12, but this issue also broke
setting current_retval_sentinel.

gcc/cp/ChangeLog:

* semantics.cc (finalize_nrv_r): [RETURN_EXPR]: Only replace the
INIT_EXPR.
gcc/cp/semantics.cc