Add a visitor for lambda expressions to RecordExprEvaluator in ExprConstant.cpp that creates an empty APValue Struct - thus supporting the following code:
constexpr auto ID = [] (auto a) { return a; };
static_assert(ID(3.14) == 3.14);
Paths
| Differential D22996
[cxx1z-constexpr-lambda] Implement constant evaluation of non-capturing lambda expressions. ClosedPublic Authored by faisalv on Jul 30 2016, 5:06 PM.
Details
Summary Add a visitor for lambda expressions to RecordExprEvaluator in ExprConstant.cpp that creates an empty APValue Struct - thus supporting the following code: constexpr auto ID = [] (auto a) { return a; };
Diff Detail
Event Timelinefaisalv marked an inline comment as done. Comment ActionsCommitted: https://reviews.llvm.org/rL295279 This revision is now accepted and ready to land.May 21 2017, 8:33 PM
Revision Contents
Diff 66231 lib/AST/ExprConstant.cpptest/SemaCXX/cxx1z-constexpr-lambdas.cpp
|
Minor nit: I think this should be "cannot".