https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125408

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <[email protected]>:

https://gcc.gnu.org/g:4073a7927b1644f5b56b83f04f92e81b31f6517b

commit r17-1727-g4073a7927b1644f5b56b83f04f92e81b31f6517b
Author: Jason Merrill <[email protected]>
Date:   Fri Jun 19 17:43:44 2026 -0400

    c++: capture folding and lvalueness checking [PR125408]

    Here after the recursive mark_rvalue_use we end up with a VAR_DECL in r, so
    the assert fails.  But in that case r is still an lvalue, so we don't need
    to do any adjustment.

    Fixed by adjusting the condition to detect the case we actually need to fix
    up, i.e. when ref is an lvalue and r is not.  The previous !rvalue_p
    condition doesn't make much sense; rvalue_p indicates whether we want to do
    an lvalue-rvalue conversion on expr, not whether expr was already an
rvalue.

            PR c++/125408

    gcc/cp/ChangeLog:

            * expr.cc (mark_use): Fix condition for changing rvalue to lvalue.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/lambda-targ34.C: New test.

Reply via email to