[clang] [C++20][Coroutines] Lambda-coroutine with operator new in promise_type (PR #84193)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 6 21:47:34 PST 2024


================
@@ -1434,13 +1434,18 @@ ExprResult Sema::ActOnCXXThis(SourceLocation Loc) {
     return Diag(Loc, diag::err_invalid_this_use) << 0;
   }
 
-  return BuildCXXThisExpr(Loc, ThisTy, /*IsImplicit=*/false);
+  return BuildCXXThisExpr(Loc, ThisTy, /*IsImplicit=*/false,
+                          SkipLambdaCaptureCheck);
 }
 
-Expr *Sema::BuildCXXThisExpr(SourceLocation Loc, QualType Type,
-                             bool IsImplicit) {
+Expr *Sema::BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit,
+                             bool SkipLambdaCaptureCheck) {
   auto *This = CXXThisExpr::Create(Context, Loc, Type, IsImplicit);
-  MarkThisReferenced(This);
+
+  if (!SkipLambdaCaptureCheck) {
----------------
shafik wrote:

Can we provide a standard reference for this code that justifies why we skip this check here?

https://github.com/llvm/llvm-project/pull/84193


More information about the cfe-commits mailing list