[clang] [Clang][RFC] Bypass TAD during overload resolution if a perfect match exists (PR #133426)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 15 15:22:33 PDT 2025


================
@@ -1216,6 +1352,24 @@ class Sema;
       return ConversionSequenceList(Conversions, NumConversions);
     }
 
+    /// Provide storage for any Expr* arg that must be preserved
+    /// until deferred template candidates are deduced.
+    /// Typically this should be used for reversed operator arguments
+    /// and any time the argument array is transformed while adding
+    /// a template candidate.
+    llvm::MutableArrayRef<Expr *> getPersistentArgsArray(unsigned N) {
+      Expr **Exprs = slabAllocate<Expr *>(N);
+      return llvm::MutableArrayRef<Expr *>(Exprs, N);
+    }
+
+    template <typename... T>
+    llvm::MutableArrayRef<Expr *> getPersistentArgsArray(T *...Exprs) {
+      llvm::MutableArrayRef<Expr *> Arr =
+          getPersistentArgsArray(sizeof...(Exprs));
+      llvm::copy(std::initializer_list<Expr *>{Exprs...}, Arr.data());
----------------
erichkeane wrote:

ah, hrmph, thats unfortunate.  There is _A_ good reason that was brought up on me in the past, but everything I can remember/think of is sort of a "well, i guess it is 'more' correct'" when it comes to pointers. So don't change it here, as the init-list stuff makes it more error prone.

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


More information about the cfe-commits mailing list