[PATCH] D132159: [llvm] Explicitly support CTAD in ArrayRef

Jeff Niu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 11:21:28 PDT 2022


Mogball created this revision.
Herald added a project: All.
Mogball requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

ArrayRef and MutableArrayRef need to explicitly declare support for CTAD,
otherwise uses of it trigger `-Wctad-maybe-unsupported` which was recently
enabled in LLVM in D131727 <https://reviews.llvm.org/D131727>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132159

Files:
  llvm/include/llvm/ADT/ArrayRef.h


Index: llvm/include/llvm/ADT/ArrayRef.h
===================================================================
--- llvm/include/llvm/ADT/ArrayRef.h
+++ llvm/include/llvm/ADT/ArrayRef.h
@@ -290,6 +290,10 @@
     /// @}
   };
 
+  /// Explicitly support class template argument deduction.
+  template <typename T>
+  ArrayRef(const T &) -> ArrayRef<T>;
+
   /// MutableArrayRef - Represent a mutable reference to an array (0 or more
   /// elements consecutively in memory), i.e. a start pointer and a length.  It
   /// allows various APIs to take and modify consecutive elements easily and
@@ -444,6 +448,10 @@
     }
   };
 
+  /// Explicitly support class template argument deduction.
+  template <typename T>
+  MutableArrayRef(T &) -> MutableArrayRef<T>;
+
   /// This is a MutableArrayRef that owns its array.
   template <typename T> class OwningArrayRef : public MutableArrayRef<T> {
   public:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132159.453725.patch
Type: text/x-patch
Size: 899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220818/65b4ac74/attachment.bin>


More information about the llvm-commits mailing list