r269951 - in /trunk/gcc: cp/ChangeLog cp/conste...

jason@gcc.gnu.org jason@gcc.gnu.org
Tue Mar 26 16:02:00 GMT 2019


Author: jason
Date: Tue Mar 26 16:02:19 2019
New Revision: 269951

URL: https://gcc.gnu.org/viewcvs?rev=269951&root=gcc&view=rev
Log:
	PR c++/86429 - constexpr variable in lambda.

When we refer to a captured variable from a constant-expression context
inside a lambda, the closure (like any function parameter) is not constant
because we aren't in a call, so we don't have an argument.  So the capture
is non-constant.  But if the captured variable is constant, we might be able
to use it directly in constexpr evaluation.

	PR c++/82643
	PR c++/87327
	* constexpr.c (cxx_eval_constant_expression): In a lambda function,
	try evaluating the captured variable directly.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const10.C
    trunk/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const9.C
    trunk/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda24.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c



More information about the Gcc-cvs mailing list