This patch enables the following code:
auto L = [](int i) { return i; }; constexpr int (*fpi)(int) = L; static_assert(fpi(3) == 3);
Paths
| Differential D22997
[cxx1z-constexpr-lambda] Make conversion function constexpr, and teach the expression-evaluator to evaluate the static-invoker. ClosedPublic Authored by faisalv on Jul 30 2016, 7:04 PM.
Details Summary This patch enables the following code: auto L = [](int i) { return i; }; constexpr int (*fpi)(int) = L; static_assert(fpi(3) == 3);
Diff Detail Event Timelinefaisalv edited edge metadata. faisalv marked 4 inline comments as done. Comment ActionsAddressed Aaron's requests regarding improving formatting and assert messages. Thanks! faisalv marked an inline comment as done. Comment ActionsSimplify the check for zero captures in a lambda expression (within the assert) by comparing the begin and end pointers directly (as opposed to using distance) - thanks to Akira! This revision is now accepted and ready to land.Jan 8 2017, 11:10 AM
Revision Contents
Diff 77926 lib/AST/ExprConstant.cpp
lib/Sema/SemaLambda.cpp
test/SemaCXX/cxx1z-constexpr-lambdas.cpp
|
Nit: remove new line.