This is an archive of the discontinued LLVM Phabricator instance.

[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; };
static_assert(ID(3.14) == 3.14);

Diff Detail

Repository
rL LLVM

Event Timeline

faisalv updated this revision to Diff 66231.Jul 30 2016, 5:06 PM
faisalv retitled this revision from to [cxx1z-constexpr-lambda] Implement constant evaluation of non-capturing lambda expressions..
faisalv updated this object.
faisalv set the repository for this revision to rL LLVM.
faisalv added a project: Restricted Project.
faisalv added a subscriber: cfe-commits.
lib/AST/ExprConstant.cpp
5775

Minor nit: I think this should be "cannot".

test/SemaCXX/cxx1z-constexpr-lambdas.cpp
10

Mark this constexpr as well?

faisalv accepted this revision.May 21 2017, 8:33 PM
faisalv marked an inline comment as done.
faisalv removed a subscriber: cfe-commits.
This revision is now accepted and ready to land.May 21 2017, 8:33 PM