https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118053
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:7e7a1b612654479e821214f7ef7658de8a132714 commit r14-11350-g7e7a1b612654479e821214f7ef7658de8a132714 Author: Jason Merrill <ja...@redhat.com> Date: Sat Feb 15 10:48:17 2025 +0100 c++: NRVO, constexpr, lambda [PR118053] Here during constant evaluation we encounter a VAR_DECL with DECL_VALUE_EXPR of the RESULT_DECL, where the latter has been adjusted for pass-by-invisible-reference. We already had the code to deal with this, we just need to use it in the non-capture case of DECL_VALUE_EXPR as well. PR c++/118053 gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_constant_expression): Generalize DECL_VALUE_EXPR invisiref handling. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/constexpr-lambda1.C: New test. (cherry picked from commit de66529f2e7bb24fb2b61b82e6a953f3f6c12902)