faisalv added a comment.

Thanks Erik!



================
Comment at: clang/lib/AST/ExprConstant.cpp:4312
+  } else if (MD && isLambdaCallOperator(MD)
+             && !Info.checkingPotentialConstantExpression()) {
     // We're in a lambda; determine the lambda capture field maps.
----------------
How about we add a comment here along the lines of: Do not attempt to create 
the variable-reference to closure data member map while 'constexpr' checking a 
lambda's function call operator (standard reference).  Currently constpexpr 
checking is done right after the end of the function definition for the 
syntehsized call operator marked explicitly constexpr - which occurs prior to 
adding the captures map to the closure object.  Alternatively we could have 
conditioned the check at the end of the function body to bypass lambda call 
operators and then invoke the constexpr check once the lambda is completely 
processed.  

Between you and me, I'm a little torn about this approach - if you can make an 
argument to consider your approach over this one - i think i could be swayed 
(if i'm not already ;) - unless of course richard weighs in as a tie breaker.


================
Comment at: clang/lib/AST/ExprConstant.cpp:5205
   // field or what the field refers to.
   if (Info.CurrentCall && isLambdaCallOperator(Info.CurrentCall->Callee)) {
+    // We don't track the lambda's captures in a potential constant expression.
----------------
I think you might want to add a check here to determine if E 
refersToEnclosingVariableOrCapture()?


https://reviews.llvm.org/D45194



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to