[llvm] a121762 - [unittests] Use std::make_tuple to make some toolchains happy again

Mikael Holmen via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 02:26:09 PDT 2020


Author: Mikael Holmen
Date: 2020-09-24T11:25:36+02:00
New Revision: a1217620a87f66616c15e869d56783ba18e51b12

URL: https://github.com/llvm/llvm-project/commit/a1217620a87f66616c15e869d56783ba18e51b12
DIFF: https://github.com/llvm/llvm-project/commit/a1217620a87f66616c15e869d56783ba18e51b12.diff

LOG: [unittests] Use std::make_tuple to make some toolchains happy again

My toolchain stopped working (LLVM 8.0, libstdc++ 5.4.0) after 577adda:

06:25:37 ../unittests/Support/Path.cpp:91:7: error: chosen constructor is explicit in copy-initialization
06:25:37       {"", false, false},  {"/", true, true},      {"/foo", true, true},
06:25:37       ^~~~~~~~~~~~~~~~~~
06:25:37 /proj/flexasic/app/llvm/8.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.4.0/../../../../include/c++/5.4.0/tuple:479:19: note: explicit constructor declared here
06:25:37         constexpr tuple(_UElements&&... __elements)
06:25:37                   ^

This commit adds explicit calls to std::make_tuple to work around
the problem.

Added: 
    

Modified: 
    llvm/unittests/Support/Path.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 10ebea7940af..ef1877381b04 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -88,11 +88,19 @@ TEST(is_separator, Works) {
 TEST(is_absolute_gnu, Works) {
   // Test tuple <Path, ExpectedPosixValue, ExpectedWindowsValue>.
   const std::tuple<StringRef, bool, bool> Paths[] = {
-      {"", false, false},  {"/", true, true},      {"/foo", true, true},
-      {"\\", false, true}, {"\\foo", false, true}, {"foo", false, false},
-      {"c", false, false}, {"c:", false, true},    {"c:\\", false, true},
-      {"!:", false, true}, {"xx:", false, false},  {"c:abc\\", false, true},
-      {":", false, false}};
+      std::make_tuple("", false, false),
+      std::make_tuple("/", true, true),
+      std::make_tuple("/foo", true, true),
+      std::make_tuple("\\", false, true),
+      std::make_tuple("\\foo", false, true),
+      std::make_tuple("foo", false, false),
+      std::make_tuple("c", false, false),
+      std::make_tuple("c:", false, true),
+      std::make_tuple("c:\\", false, true),
+      std::make_tuple("!:", false, true),
+      std::make_tuple("xx:", false, false),
+      std::make_tuple("c:abc\\", false, true),
+      std::make_tuple(":", false, false)};
 
   for (const auto &Path : Paths) {
     EXPECT_EQ(path::is_absolute_gnu(std::get<0>(Path), path::Style::posix),


        


More information about the llvm-commits mailing list