Previously, this caused ExprConstant to assert while verifying the lambda is constexpr:
void f() {
int x = 0;
[=]() constexpr {
return x;
};
}The problem is that ActOnFinishFunctionBody evaluated the lambda's body before BuildLambdaExpr finished the lambda class. This patch fixes the problem by moving that check to BuildLambdaExpr.
PR36054
Thanks for taking a look!
Erik