[PATCH] D45194: [Sema] Defer checking constexpr lambda until after we've finished the lambda class.
Faisal Vali via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 3 20:56:49 PDT 2018
faisalv added a comment.
Thanks for working on this fairly embarrassing bug (let's fix this before the week is over :)
================
Comment at: clang/lib/Sema/SemaDecl.cpp:12886
if (!IsInstantiation && FD && FD->isConstexpr() && !FD->isInvalidDecl() &&
+ !isLambdaCallOperator(FD) &&
(!CheckConstexprFunctionDecl(FD) ||
----------------
Hmm - as opposed to further leaking our lambda's implementation-details into ActOnFinishFunctionBody - and duplicating these checks for a lambda marked constexpr, I think I would prefer teaching the expression-evaluator (ExprConstant.cpp) to know how to check a lambda's function call operator for constexprness (i.e. avoid creating the capture-to-field-map when 'checkingPotentialConstantExpression()' and ignore evaluating expressions that refer to enclosing variables since their evaluation should not affect inferring constexprness).
Thoughts?
Repository:
rC Clang
https://reviews.llvm.org/D45194
More information about the cfe-commits
mailing list