[libcxx] r288556 - Work around Clang 3.8 bugs

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 2 16:13:34 PST 2016


Author: ericwf
Date: Fri Dec  2 18:13:33 2016
New Revision: 288556

URL: http://llvm.org/viewvc/llvm-project?rev=288556&view=rev
Log:
Work around Clang 3.8 bugs

Modified:
    libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
    libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp
    libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
    libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
    libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
    libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp

Modified: libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp?rev=288556&r1=288555&r2=288556&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp Fri Dec  2 18:13:33 2016
@@ -10,6 +10,9 @@
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 
+// Clang 3.8 doesn't generate constexpr special members correctly.
+// XFAIL: clang-3.8
+
 // <variant>
 
 // template <class ...Types> class variant;
@@ -174,8 +177,32 @@ void test_copy_assignment_different_inde
   }
 }
 
+template <size_t NewIdx, class ValueType>
+constexpr bool test_constexpr_assign_extension_imp(
+    std::variant<long, void*, int>&& v, ValueType&& new_value)
+{
+  const std::variant<long, void*, int> cp(
+      std::forward<ValueType>(new_value));
+  v = cp;
+  return v.index() == NewIdx &&
+        std::get<NewIdx>(v) == std::get<NewIdx>(cp);
+}
+
+void test_constexpr_copy_assignment_extension() {
+#ifdef _LIBCPP_VERSION
+  using V = std::variant<long, void*, int>;
+  static_assert(std::is_trivially_copyable<V>::value, "");
+  static_assert(std::is_trivially_copy_assignable<V>::value, "");
+  static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), "");
+  static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), "");
+  static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), "");
+  static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), "");
+#endif
+}
+
 int main() {
   test_copy_assignment_same_index();
   test_copy_assignment_different_index();
   test_copy_assignment_sfinae();
+  test_constexpr_copy_assignment_extension();
 }

Modified: libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp?rev=288556&r1=288555&r2=288556&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp Fri Dec  2 18:13:33 2016
@@ -10,6 +10,9 @@
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 
+// Clang 3.8 doesn't generate constexpr special members correctly.
+// XFAIL: clang-3.8
+
 // <variant>
 
 // template <class ...Types> class variant;
@@ -160,8 +163,34 @@ void test_move_assignment_different_inde
   }
 }
 
+
+template <size_t NewIdx, class ValueType>
+constexpr bool test_constexpr_assign_extension_imp(
+    std::variant<long, void*, int>&& v, ValueType&& new_value)
+{
+  std::variant<long, void*, int> v2(
+      std::forward<ValueType>(new_value));
+  const auto cp = v2;
+  v = std::move(v2);
+  return v.index() == NewIdx &&
+        std::get<NewIdx>(v) == std::get<NewIdx>(cp);
+}
+
+void test_constexpr_move_assignment_extension() {
+#ifdef _LIBCPP_VERSION
+  using V = std::variant<long, void*, int>;
+  static_assert(std::is_trivially_copyable<V>::value, "");
+  static_assert(std::is_trivially_move_assignable<V>::value, "");
+  static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), "");
+  static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), "");
+  static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), "");
+  static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), "");
+#endif
+}
+
 int main() {
   test_move_assignment_same_index();
   test_move_assignment_different_index();
   test_move_assignment_sfinae();
+  test_constexpr_move_assignment_extension();
 }

Modified: libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp?rev=288556&r1=288555&r2=288556&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp Fri Dec  2 18:13:33 2016
@@ -385,28 +385,6 @@ void test_copy_assignment_different_inde
 #endif
 }
 
-template <size_t NewIdx, class ValueType>
-constexpr bool test_constexpr_assign_extension_imp(
-    std::variant<long, void*, int>&& v, ValueType&& new_value)
-{
-  const std::variant<long, void*, int> cp(
-      std::forward<ValueType>(new_value));
-  v = cp;
-  return v.index() == NewIdx &&
-        std::get<NewIdx>(v) == std::get<NewIdx>(cp);
-}
-
-void test_constexpr_copy_assignment_extension() {
-#ifdef _LIBCPP_VERSION
-  using V = std::variant<long, void*, int>;
-  static_assert(std::is_trivially_copyable<V>::value, "");
-  static_assert(std::is_trivially_copy_assignable<V>::value, "");
-  static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), "");
-  static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), "");
-  static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), "");
-  static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), "");
-#endif
-}
 
 int main() {
   test_copy_assignment_empty_empty();
@@ -416,5 +394,4 @@ int main() {
   test_copy_assignment_different_index();
   test_copy_assignment_sfinae();
   test_copy_assignment_not_noexcept();
-  test_constexpr_copy_assignment_extension();
 }

Modified: libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp?rev=288556&r1=288555&r2=288556&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp Fri Dec  2 18:13:33 2016
@@ -308,29 +308,6 @@ void test_move_assignment_different_inde
 #endif
 }
 
-template <size_t NewIdx, class ValueType>
-constexpr bool test_constexpr_assign_extension_imp(
-    std::variant<long, void*, int>&& v, ValueType&& new_value)
-{
-  std::variant<long, void*, int> v2(
-      std::forward<ValueType>(new_value));
-  const auto cp = v2;
-  v = std::move(v2);
-  return v.index() == NewIdx &&
-        std::get<NewIdx>(v) == std::get<NewIdx>(cp);
-}
-
-void test_constexpr_move_assignment_extension() {
-#ifdef _LIBCPP_VERSION
-  using V = std::variant<long, void*, int>;
-  static_assert(std::is_trivially_copyable<V>::value, "");
-  static_assert(std::is_trivially_move_assignable<V>::value, "");
-  static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), "");
-  static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), "");
-  static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), "");
-  static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), "");
-#endif
-}
 int main() {
   test_move_assignment_empty_empty();
   test_move_assignment_non_empty_empty();
@@ -339,5 +316,4 @@ int main() {
   test_move_assignment_different_index();
   test_move_assignment_sfinae();
   test_move_assignment_noexcept();
-  test_constexpr_move_assignment_extension();
 }

Modified: libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp?rev=288556&r1=288555&r2=288556&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp Fri Dec  2 18:13:33 2016
@@ -10,6 +10,9 @@
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 
+// Clang 3.8 doesn't allow constexpr variables of non-literal type
+// XFAIL: clang-3.8
+
 // <variant>
 
 // template <class ...Types> class variant;

Modified: libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp?rev=288556&r1=288555&r2=288556&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp Fri Dec  2 18:13:33 2016
@@ -10,6 +10,9 @@
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 
+// Clang 3.8 doesn't allow constexpr variables of non-literal type
+// XFAIL: clang-3.8
+
 // <variant>
 
 // template <class ...Types> class variant;




More information about the cfe-commits mailing list