[PATCH] D74009: [clang] Improve diagnostic note for implicit conversions that are disallowed because they involve more than one user-defined conversion.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 17:44:57 PST 2020


rsmith added a comment.

This is an interesting idea. Have you looked into whether you can defer the check for conversion via multiple user-defined conversions until we come to call `CompleteNonViableCandidate` after finding no viable functions? That'd give me a lot more confidence that this won't introduce a noticeable performance regression for pathological cases (eg, considering a quadratic -- or worse -- number of combinations of constructors and conversion functions).



================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:4068
+    "%diff{from $ to $|from argument type to parameter type}3,4 "
+    "applies more than one implicit user-defined conversion"
+    >;
----------------
applies -> would apply


================
Comment at: clang/include/clang/Sema/Sema.h:2947-2956
+  enum UserDefinedConversionsKind {
+    /// Allow user-defined conversions.
+    UDC_Allow,
+    
+    /// Find user-defined conversions but mark as invalid.
+    UDC_Suppress,
+    
----------------
Please use an `enum class` here, so that call sites are more meaningful (`UserDefinedConversions::Allow` vs `UDC_Allow`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74009





More information about the cfe-commits mailing list