https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112301
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Summary|Double destruction of |[Regression 12/13/14] |returned object when |Double destruction of |exiting the scope causes an |returned object when |exception which gets |exiting the scope causes an |rethrown |exception which gets | |rethrown CC| |jason at gcc dot gnu.org Last reconfirmed| |2023-10-30 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Confirmed as a regression starting with r12-6333-gb10e031458d541 Author: Jason Merrill Date: Wed Jan 5 22:01:12 2022 c++: destroy retval on throwing cleanup in try [PR33799] My earlier attempt to fix this bug didn't handle the case where both the return and the throwing cleanup are within a try-block that catches and discards the exception. Fixed by adding the retval cleanup to any try-blocks as well as the function body. PR102191 pointed out that we also weren't handling templates properly, so I moved the call out of the parser. PR c++/33799 PR c++/102191