[PATCH] D68845: Don't emit unwanted constructor calls in co_return statements

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 29 15:30:18 PDT 2019


aaronpuchert added inline comments.


================
Comment at: clang/lib/Sema/SemaCoroutine.cpp:896
+      if (S.CanPerformCopyInitialization(Entity, &AsRvalue))
+        return true;
+    } else if (auto *FTD = dyn_cast<FunctionTemplateDecl>(D)) {
----------------
Overlad resolution can actually still fail if there is a viable candidate, namely when there are multiple candidates and none is better than all others. It's a bit weird though to fall back to lvalue parameter then as if nothing happened.


================
Comment at: clang/lib/Sema/SemaCoroutine.cpp:903-909
+            QualType ParamType = ParamTypes[0];
+            if (!ParamType->isDependentType()) {
+              InitializedEntity Entity = InitializedEntity::InitializeParameter(
+                  S.Context, ParamType, false);
+              if (!S.CanPerformCopyInitialization(Entity, &AsRvalue))
+                return true;
+            }
----------------
I should add a test case where this is necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68845





More information about the cfe-commits mailing list