[clang] [C++20][Coroutines] lambda-coroutine with promise_type ctor. (PR #84519)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 17:10:35 PST 2024


================
@@ -596,8 +596,21 @@ VarDecl *Sema::buildCoroutinePromise(SourceLocation Loc) {
 
   // Add implicit object parameter.
   if (auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
-    if (MD->isImplicitObjectMemberFunction() && !isLambdaCallOperator(MD)) {
-      ExprResult ThisExpr = ActOnCXXThis(Loc);
+    if (MD->isImplicitObjectMemberFunction()) {
+      ExprResult ThisExpr{};
+
+      if (isLambdaCallOperator(MD) && !MD->isStatic()) {
+        Qualifiers ThisQuals = MD->getMethodQualifiers();
+        CXXRecordDecl *Record = MD->getParent();
+
+        Sema::CXXThisScopeRAII ThisScope(*this, Record, ThisQuals,
+                                         Record != nullptr);
----------------
shafik wrote:

```suggestion
                                         /*Enabled=*/Record != nullptr);
```

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


More information about the cfe-commits mailing list