aaron.ballman added a comment.

Precommit CI seems to have caught valid failures this time.



================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:152
 bool CheckDefaultArgumentVisitor::VisitLambdaExpr(const LambdaExpr *Lambda) {
-  // C++11 [expr.lambda.prim]p13:
-  //   A lambda-expression appearing in a default argument shall not
-  //   implicitly or explicitly capture any entity.
-  if (Lambda->capture_begin() == Lambda->capture_end())
-    return false;
-
-  return S.Diag(Lambda->getBeginLoc(), diag::err_lambda_capture_default_arg);
+  // [expr.prim.lambda.capture]/p9
+  // a lambda-expression appearing in a default argument cannot implicitly or 
explicitly capture any local entity.
----------------



================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:157
+  bool Invalid = false;
+  for(const LambdaCapture& LC : Lambda->captures()) {
+    if(!Lambda->isInitCapture(&LC))
----------------



================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:158
+  for(const LambdaCapture& LC : Lambda->captures()) {
+    if(!Lambda->isInitCapture(&LC))
+      return S.Diag(LC.getLocation(), diag::err_lambda_capture_default_arg);
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137172/new/

https://reviews.llvm.org/D137172

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

Reply via email to