https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122163
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Nathaniel Shead <[email protected]>: https://gcc.gnu.org/g:ac524299110838ed8eafb615d100a28649af7f18 commit r16-4384-gac524299110838ed8eafb615d100a28649af7f18 Author: Nathaniel Shead <[email protected]> Date: Sun Oct 5 21:30:56 2025 +1100 c++: Ensure mark_lvalue_use returns an lvalue [PR122163] When processing a tentative capture of a rvalue reference, mark_use folds it away to the referred-to entity. But this is an rvalue, and when called from an lvalue context an rvalue reference should still be an lvalue. PR c++/122163 gcc/cp/ChangeLog: * expr.cc (mark_use): When processing a reference, always return an lvalue reference when !rvalue_p. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-ref3.C: New test. Signed-off-by: Nathaniel Shead <[email protected]> Reviewed-by: Jason Merrill <[email protected]>
