[PATCH] D45194: [Sema] Defer checking constexpr lambda until after we've finished the lambda class.

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 4 11:10:59 PDT 2018


erik.pilkington added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:12886
     if (!IsInstantiation && FD && FD->isConstexpr() && !FD->isInvalidDecl() &&
+        !isLambdaCallOperator(FD) &&
         (!CheckConstexprFunctionDecl(FD) ||
----------------
faisalv wrote:
> 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?
> 
> 
That's a really good point, makes this a lot simpler. Thanks!


https://reviews.llvm.org/D45194





More information about the cfe-commits mailing list