[Bug c++/57533] When throwing local variable, it's being move-constructed even if not going out of scope.
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 4 10:59:49 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57533
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Most of that commit only affects C++20 mode, but it includes:
* typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
The new treat_lvalue_as_rvalue_p code says:
+ /* if the operand of a throw-expression is a (possibly parenthesized)
+ id-expression that names an implicitly movable entity whose scope does
not
+ extend beyond the compound-statement of the innermost try-block or
+ function-try-block (if any) whose compound-statement or ctor-initializer
+ encloses the throw-expression, */
The "whose scope does not extend" part is what was missing before.
More information about the Gcc-bugs
mailing list