[PATCH] D154368: [Clang] Fix constraint checking of non-generic lambdas.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 06:44:54 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:4718-4719
+def note_ovl_surrogate_constraints_not_satisfied : Note<
+    "candidate surrogate function %0 not viable: constraints "
+    "not satisfied">;
 def note_implicit_member_target_infer_collision : Note<
----------------
I think "candidate surrogate function" is a bit... technical for a user-facing diagnostic (we don't seem to use it any other diagnostics). Perhaps we should go with `conversion candidate function` instead as we did for `note_ovl_surrogate_cand`?


================
Comment at: clang/lib/Sema/SemaConcept.cpp:685
+  // (and may refer to its parameters), so check the call operator instead.
+  if (const CXXConversionDecl *MD = dyn_cast<CXXConversionDecl>(FD);
+      MD && isLambdaConversionOperator(const_cast<CXXConversionDecl *>(MD)))
----------------



================
Comment at: clang/lib/Sema/SemaLambda.cpp:1636-1638
+  // A non-generic lambda may still be a templated entity
+  // We need to preserve constraints when converting the
+  // lambda to a function pointer. See GH63181.
----------------



================
Comment at: clang/lib/Sema/SemaOverload.cpp:14973
+  // conversion operator as the constraints are always the same.
+  // As the user probably do not intend to perform a surrogate call,
+  // we filter them out to produce better error diagnostics, ie to avoid
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154368



More information about the cfe-commits mailing list