diff options
author | Jason Merrill <jason@redhat.com> | 2023-06-04 12:00:55 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-06-06 21:30:59 -0400 |
commit | b192e2007e1c98b548f4aa878523b485968d24a4 (patch) | |
tree | 4f16ac9cd7306be8fb08fe623ef1fd00cd1e436b /gcc/expr.cc | |
parent | 08cea4e56a094ff9cc7c65fdc9ce8c4d7aff64be (diff) | |
download | gcc-b192e2007e1c98b548f4aa878523b485968d24a4.zip gcc-b192e2007e1c98b548f4aa878523b485968d24a4.tar.gz gcc-b192e2007e1c98b548f4aa878523b485968d24a4.tar.bz2 |
c++: NRV and goto [PR92407]
Here our named return value optimization was breaking the required
destructor when the goto takes 'a' out of scope. The simplest fix is to
disable the optimization in the presence of user labels.
We could do better by disabling the optimization only if there is a backward
goto across the variable declaration, but we don't currently track that.
PR c++/92407
gcc/cp/ChangeLog:
* typeck.cc (check_return_expr): Prevent NRV in the presence of
named labels.
gcc/testsuite/ChangeLog:
* g++.dg/opt/nrv22.C: New test.
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions