]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: constexpr and lambda capture [PR90212]
authorJason Merrill <jason@redhat.com>
Mon, 25 May 2020 22:04:39 +0000 (18:04 -0400)
committerJason Merrill <jason@redhat.com>
Mon, 25 May 2020 22:04:42 +0000 (18:04 -0400)
commitaa613a81831bdc044840a95a7a7803a235608503
tree268c71220290d7b156d62352d66cd83b31b5cc02
parentc79e664b153bd4cfdeec77b495d595e50b97c752
c++: constexpr and lambda capture [PR90212]

This is the same issue as PR86429, just in potential_constant_expression_1
rather than cxx_eval_constant_expression.  As in that case, when we're
trying to evaluate a constant expression within a lambda, we don't have a
constant closure object to refer to, but we can try to refer directly to the
captured variable.

gcc/cp/ChangeLog
2020-05-05  Jason Merrill  <jason@redhat.com>

PR c++/90212
* constexpr.c (potential_constant_expression_1): In a lambda
function, consider a captured variable directly.
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-constexpr2.C [new file with mode: 0644]