]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: NRVO, constexpr, lambda [PR118053]
authorJason Merrill <jason@redhat.com>
Sat, 15 Feb 2025 09:48:17 +0000 (10:48 +0100)
committerJason Merrill <jason@redhat.com>
Sat, 15 Feb 2025 12:27:17 +0000 (13:27 +0100)
commitde66529f2e7bb24fb2b61b82e6a953f3f6c12902
tree9a9da9f53e5616af68bed38408020f6452fab10d
parentbf84e5e64662f8f0fdebfc0212e32bfca678f9eb
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.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/cpp1y/constexpr-lambda1.C [new file with mode: 0644]