[llvm] Repair the modules build with C++17
authorJonas Devlieghere <jonas@devlieghere.com>
Mon, 8 Aug 2022 21:38:09 +0000 (14:38 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Mon, 8 Aug 2022 22:04:46 +0000 (15:04 -0700)
I'm honestly not sure if this is a legitimate issue or not, but after
switching from C++14 to C++17, the modules build started confusing
arrays and initializer lists. Work around the issue by being explicit.

llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/Support/FormatProviders.h

index 8e18b6a..c56ca97 100644 (file)
@@ -725,8 +725,8 @@ class zip_shortest : public zip_common<zip_shortest<Iters...>, Iters...> {
   template <size_t... Ns>
   bool test(const zip_shortest<Iters...> &other,
             std::index_sequence<Ns...>) const {
-    return all_of(std::initializer_list<bool>{std::get<Ns>(this->iterators) !=
-                                              std::get<Ns>(other.iterators)...},
+    return all_of(std::array{std::get<Ns>(this->iterators) !=
+                             std::get<Ns>(other.iterators)...},
                   identity<bool>{});
   }
 
index 8101ed7..7cfce29 100644 (file)
@@ -21,8 +21,8 @@
 #include "llvm/Support/FormatVariadicDetails.h"
 #include "llvm/Support/NativeFormatting.h"
 
+#include <array>
 #include <type_traits>
-#include <vector>
 
 namespace llvm {
 namespace detail {
@@ -369,7 +369,7 @@ template <typename IterT> class format_provider<llvm::iterator_range<IterT>> {
       return Default;
     }
 
-    for (const char *D : {"[]", "<>", "()"}) {
+    for (const char *D : std::array{"[]", "<>", "()"}) {
       if (Style.front() != D[0])
         continue;
       size_t End = Style.find_first_of(D[1]);