[PATCH] D32671: [libcxx] [test] variant: test coverage for P0602 extension

2017-05-25 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: 
test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp:389
+template
+constexpr bool triviality_test =
+  std::is_trivially_copy_assignable::value ==

`triviality_test` should also compare to an explicitly specified expected 
result, along with checking for consistency between variant and its input types.



Comment at: 
test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp:168
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  static_assert(triviality_test, "");

These tests pass with libc++ too, so please add `|| defined(_LIBCPP_VERSION)`



Comment at: 
test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp:206
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  static_assert(triviality_test, "");

These tests pass with libc++ too, so please add `|| defined(_LIBCPP_VERSION)`


https://reviews.llvm.org/D32671



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32671: [libcxx] [test] variant: test coverage for P0602 extension

2017-05-24 Thread Michael Park via Phabricator via cfe-commits
mpark added a comment.

Yes, you're right that fine-grained SMF triviality is implemented but LWG 2904 
is not yet.
I would love it if you can integrate the currently `libcxx` tests into `std` 
tests!

Thank you :)


https://reviews.llvm.org/D32671



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32671: [libcxx] [test] variant: test coverage for P0602 extension

2017-05-04 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter updated this revision to Diff 97834.
CaseyCarter added a comment.

The constexpr variant tests were enabled separate commit 
(https://reviews.llvm.org/rL302158). This differential now contains only the 
fine-grained SMF triviality extension test.


https://reviews.llvm.org/D32671

Files:
  test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
  test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
  test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
  test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp

Index: test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
===
--- test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
+++ test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
@@ -197,10 +197,30 @@
 #endif
 }
 
+template
+constexpr bool triviality_test =
+  std::is_trivially_move_constructible::value ==
+std::conjunction::value;
+
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+#endif
+}
+
 int main() {
   test_move_ctor_basic();
   test_move_ctor_valueless_by_exception();
   test_move_noexcept();
   test_move_ctor_sfinae();
   test_constexpr_move_ctor_extension();
+  test_triviality_extension();
 }
Index: test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
===
--- test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
+++ test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
@@ -159,9 +159,27 @@
 #endif
 }
 
+template
+constexpr bool triviality_test =
+  std::is_trivially_copy_constructible::value ==
+std::conjunction::value;
+
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+#endif
+}
+
 int main() {
   test_copy_ctor_basic();
   test_copy_ctor_valueless_by_exception();
   test_copy_ctor_sfinae();
   test_constexpr_copy_ctor_extension();
+  test_triviality_extension();
 }
Index: test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
===
--- test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
+++ test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
@@ -308,12 +308,63 @@
 #endif
 }
 
+template
+constexpr bool triviality_test =
+  // move assignment of variant is trivial when
+  std::is_trivially_move_assignable::value ==
+std::conjunction<
+  // All Ts are trivially destructible and
+  std::is_trivially_destructible...,
+  // either
+  std::disjunction<
+// All Ts are trivially move (constructible and assignable) so that
+// variant's move assignment operator is non-deleted and trivial, or
+std::conjunction<
+  std::is_trivially_move_constructible...,
+  std::is_trivially_move_assignable...>,
+// At least one of the Ts is not move (constructible or assignable) so
+// that variant's move assignment operator is *implicitly* deleted but
+// all of the Ts are trivially *copy* (constructible and assignable) so
+// that move assignment actually invokes the trivial copy assignment
+// operator.
+std::conjunction<
+  std::disjunction<
+std::negation...,
+std::negation...>,
+  std::is_trivially_copy_constructible...,
+  std::is_trivially_copy_assignable...>>>::value;
+
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  struct TrivialCopyNontrivialMove {
+TrivialCopyNontrivialMove(TrivialCopyNontrivialMove const&) = default;
+TrivialCopyNontrivialMove(TrivialCopyNontrivialMove&&) noexcept {}
+TrivialCopyNontrivialMove& operator=(TrivialCopyNontrivialMove const&) = default;
+TrivialCopyNontrivialMove& operator=(TrivialCopyNontrivialMove&&) noexcept {
+  return *this;
+}
+  };
+
+  static_assert(triviality_test, 

[PATCH] D32671: [libcxx] [test] variant: test coverage for P0602 extension

2017-05-04 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

Could you commit all the changes *except* the trivial extensions tests, and 
then update this to contain only that?


https://reviews.llvm.org/D32671



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32671: [libcxx] [test] variant: test coverage for P0602 extension

2017-05-03 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter updated this revision to Diff 97768.
CaseyCarter added a comment.

Fix typos in 
test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp.


https://reviews.llvm.org/D32671

Files:
  test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
  test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
  test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
  test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
  test/support/msvc_stdlib_force_include.hpp
  test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
  test/support/test_workarounds.h

Index: test/support/test_workarounds.h
===
--- test/support/test_workarounds.h
+++ test/support/test_workarounds.h
@@ -15,6 +15,7 @@
 
 #if defined(TEST_COMPILER_C1XX)
 # define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
+# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
 #endif
 
 #endif // SUPPORT_TEST_WORKAROUNDS_H
Index: test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
===
--- /dev/null
+++ test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
@@ -0,0 +1,31 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// Verify TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE.
+
+#include 
+
+#include "test_workarounds.h"
+
+struct S {
+  S(S const&) = default;
+  S(S&&) = default;
+  S& operator=(S const&) = delete;
+  S& operator=(S&&) = delete;
+};
+
+int main() {
+#if defined(TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE)
+  static_assert(!std::is_trivially_copyable::value, "");
+#else
+  static_assert(std::is_trivially_copyable::value, "");
+#endif
+}
Index: test/support/msvc_stdlib_force_include.hpp
===
--- test/support/msvc_stdlib_force_include.hpp
+++ test/support/msvc_stdlib_force_include.hpp
@@ -26,6 +26,11 @@
 #error This header may not be used when targeting libc++
 #endif
 
+// Indicates that we are using the MSVC standard library.
+#ifndef _MSVC_STL_VER
+#define _MSVC_STL_VER 42
+#endif
+
 struct AssertionDialogAvoider {
 AssertionDialogAvoider() {
 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
Index: test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
===
--- test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
+++ test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
@@ -22,6 +22,7 @@
 #include 
 
 #include "test_macros.h"
+#include "test_workarounds.h"
 
 struct ThrowsMove {
   ThrowsMove(ThrowsMove &&) noexcept(false) {}
@@ -178,20 +179,48 @@
 }
 
 void test_constexpr_move_ctor_extension() {
-#ifdef _LIBCPP_VERSION
+#if defined(_LIBCPP_VER) || defined(_MSVC_STL_VER)
   using V = std::variant;
+#ifdef TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
+  static_assert(std::is_trivially_destructible::value, "");
+  static_assert(std::is_trivially_copy_constructible::value, "");
+  static_assert(std::is_trivially_move_constructible::value, "");
+  static_assert(!std::is_copy_assignable::value, "");
+  static_assert(!std::is_move_assignable::value, "");
+#else
   static_assert(std::is_trivially_copyable::value, "");
+#endif
   static_assert(std::is_trivially_move_constructible::value, "");
   static_assert(test_constexpr_ctor_extension_imp<0>(V(42l)), "");
   static_assert(test_constexpr_ctor_extension_imp<1>(V(nullptr)), "");
   static_assert(test_constexpr_ctor_extension_imp<2>(V(101)), "");
 #endif
 }
 
+template
+constexpr bool triviality_test =
+  std::is_trivially_move_constructible::value ==
+std::conjunction::value;
+
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+#endif
+}
+
 int main() {
   test_move_ctor_basic();
   test_move_ctor_valueless_by_exception();
   test_move_noexcept();
   test_move_ctor_sfinae();
   test_constexpr_move_ctor_extension();
+  

[PATCH] D32671: [libcxx] [test] variant: test coverage for P0602 extension

2017-05-01 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter updated this revision to Diff 97367.
CaseyCarter added a comment.

Fix missing indent in msvc_stdlib_force_include.hpp


https://reviews.llvm.org/D32671

Files:
  test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
  test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
  test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
  test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
  test/support/msvc_stdlib_force_include.hpp
  test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
  test/support/test_workarounds.h

Index: test/support/test_workarounds.h
===
--- test/support/test_workarounds.h
+++ test/support/test_workarounds.h
@@ -15,6 +15,7 @@
 
 #if defined(TEST_COMPILER_C1XX)
 # define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
+# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
 #endif
 
 #endif // SUPPORT_TEST_WORKAROUNDS_H
Index: test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
===
--- /dev/null
+++ test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
@@ -0,0 +1,31 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// Verify TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE.
+
+#include 
+
+#include "test_workarounds.h"
+
+struct S {
+  S(S const&) = default;
+  S(S&&) = default;
+  S& operator=(S const&) = delete;
+  S& operator=(S&&) = delete;
+};
+
+int main() {
+#if defined(TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE)
+  static_assert(!std::is_trivially_copyable::value, "");
+#else
+  static_assert(std::is_trivially_copyable::value, "");
+#endif
+}
Index: test/support/msvc_stdlib_force_include.hpp
===
--- test/support/msvc_stdlib_force_include.hpp
+++ test/support/msvc_stdlib_force_include.hpp
@@ -26,6 +26,11 @@
 #error This header may not be used when targeting libc++
 #endif
 
+// Indicates that we are using the MSVC standard library.
+#ifndef _MSVC_STL_VER
+#define _MSVC_STL_VER 42
+#endif
+
 struct AssertionDialogAvoider {
 AssertionDialogAvoider() {
 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
Index: test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
===
--- test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
+++ test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
@@ -22,6 +22,7 @@
 #include 
 
 #include "test_macros.h"
+#include "test_workarounds.h"
 
 struct ThrowsMove {
   ThrowsMove(ThrowsMove &&) noexcept(false) {}
@@ -178,20 +179,48 @@
 }
 
 void test_constexpr_move_ctor_extension() {
-#ifdef _LIBCPP_VERSION
+#if defined(_LIBCPP_VER) || defined(_MSVC_STL_VER)
   using V = std::variant;
+#ifdef TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
+  static_assert(std::is_trivially_destructible::value, "");
+  static_assert(std::is_trivially_copy_constructible::value, "");
+  static_assert(std::is_trivially_move_constructible::value, "");
+  static_assert(!std::is_copy_assignable::value, "");
+  static_assert(!std::is_move_assignable::value, "");
+#else
   static_assert(std::is_trivially_copyable::value, "");
+#endif
   static_assert(std::is_trivially_move_constructible::value, "");
   static_assert(test_constexpr_ctor_extension_imp<0>(V(42l)), "");
   static_assert(test_constexpr_ctor_extension_imp<1>(V(nullptr)), "");
   static_assert(test_constexpr_ctor_extension_imp<2>(V(101)), "");
 #endif
 }
 
+template
+constexpr bool triviality_test =
+  std::is_trivially_move_constructible::value ==
+std::conjunction::value;
+
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+#endif
+}
+
 int main() {
   test_move_ctor_basic();
   test_move_ctor_valueless_by_exception();
   test_move_noexcept();
   test_move_ctor_sfinae();
   test_constexpr_move_ctor_extension();
+  test_triviality_extension();
 }
Index: 

[PATCH] D32671: [libcxx] [test] variant: test coverage for P0602 extension

2017-04-29 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter updated this revision to Diff 97204.
CaseyCarter added a comment.

Fix a weird corner case in variant's move assignment triviality test.


https://reviews.llvm.org/D32671

Files:
  test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
  test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
  test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
  test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
  test/support/msvc_stdlib_force_include.hpp
  test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
  test/support/test_workarounds.h

Index: test/support/test_workarounds.h
===
--- test/support/test_workarounds.h
+++ test/support/test_workarounds.h
@@ -15,6 +15,7 @@
 
 #if defined(TEST_COMPILER_C1XX)
 # define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
+# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
 #endif
 
 #endif // SUPPORT_TEST_WORKAROUNDS_H
Index: test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
===
--- /dev/null
+++ test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
@@ -0,0 +1,31 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// Verify TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE.
+
+#include 
+
+#include "test_workarounds.h"
+
+struct S {
+  S(S const&) = default;
+  S(S&&) = default;
+  S& operator=(S const&) = delete;
+  S& operator=(S&&) = delete;
+};
+
+int main() {
+#if defined(TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE)
+  static_assert(!std::is_trivially_copyable::value, "");
+#else
+  static_assert(std::is_trivially_copyable::value, "");
+#endif
+}
Index: test/support/msvc_stdlib_force_include.hpp
===
--- test/support/msvc_stdlib_force_include.hpp
+++ test/support/msvc_stdlib_force_include.hpp
@@ -26,6 +26,11 @@
 #error This header may not be used when targeting libc++
 #endif
 
+// Indicates that we are using the MSVC standard library.
+#ifndef _MSVC_STL_VER
+#define _MSVC_STL_VER 42
+#endif
+
 struct AssertionDialogAvoider {
 AssertionDialogAvoider() {
 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
Index: test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
===
--- test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
+++ test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
@@ -22,6 +22,7 @@
 #include 
 
 #include "test_macros.h"
+#include "test_workarounds.h"
 
 struct ThrowsMove {
   ThrowsMove(ThrowsMove &&) noexcept(false) {}
@@ -178,20 +179,48 @@
 }
 
 void test_constexpr_move_ctor_extension() {
-#ifdef _LIBCPP_VERSION
+#if defined(_LIBCPP_VER) || defined(_MSVC_STL_VER)
   using V = std::variant;
+#ifdef TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
+  static_assert(std::is_trivially_destructible::value, "");
+  static_assert(std::is_trivially_copy_constructible::value, "");
+  static_assert(std::is_trivially_move_constructible::value, "");
+  static_assert(!std::is_copy_assignable::value, "");
+  static_assert(!std::is_move_assignable::value, "");
+#else
   static_assert(std::is_trivially_copyable::value, "");
+#endif
   static_assert(std::is_trivially_move_constructible::value, "");
   static_assert(test_constexpr_ctor_extension_imp<0>(V(42l)), "");
   static_assert(test_constexpr_ctor_extension_imp<1>(V(nullptr)), "");
   static_assert(test_constexpr_ctor_extension_imp<2>(V(101)), "");
 #endif
 }
 
+template
+constexpr bool triviality_test =
+  std::is_trivially_move_constructible::value ==
+std::conjunction::value;
+
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+#endif
+}
+
 int main() {
   test_move_ctor_basic();
   test_move_ctor_valueless_by_exception();
   test_move_noexcept();
   test_move_ctor_sfinae();
   test_constexpr_move_ctor_extension();
+  test_triviality_extension();
 }
Index: 

[PATCH] D32671: [libcxx] [test] variant: test coverage for P0602 extension

2017-04-29 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter created this revision.

NOTE: Unlike my typical `variant` test PRs, this one is actually safe to merge 
- crazy, I know - since it only adds coverage while testing the VC++ STL.



- Define a new macro `_MSVC_STL_VER` to distinguish testing the VC++ standard 
library implementation in the style of `_LIBCPP_VER`.

- Enable the "constexpr extension" tests for variant's copy/move constructors 
on VC++

- Add some new "triviality extension" tests for variant's conformance to P0602, 
currently only enabled on VC++

- Workaround C1XX's buggy `__is_trivially_copyable` in the variant tests.


https://reviews.llvm.org/D32671

Files:
  test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
  test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
  test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
  test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
  test/support/msvc_stdlib_force_include.hpp
  test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
  test/support/test_workarounds.h

Index: test/support/test_workarounds.h
===
--- test/support/test_workarounds.h
+++ test/support/test_workarounds.h
@@ -15,6 +15,7 @@
 
 #if defined(TEST_COMPILER_C1XX)
 # define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
+# define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
 #endif
 
 #endif // SUPPORT_TEST_WORKAROUNDS_H
Index: test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
===
--- /dev/null
+++ test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp
@@ -0,0 +1,31 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// Verify TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE.
+
+#include 
+
+#include "test_workarounds.h"
+
+struct S {
+  S(S const&) = default;
+  S(S&&) = default;
+  S& operator=(S const&) = delete;
+  S& operator=(S&&) = delete;
+};
+
+int main() {
+#if defined(TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE)
+  static_assert(!std::is_trivially_copyable::value, "");
+#else
+  static_assert(std::is_trivially_copyable::value, "");
+#endif
+}
Index: test/support/msvc_stdlib_force_include.hpp
===
--- test/support/msvc_stdlib_force_include.hpp
+++ test/support/msvc_stdlib_force_include.hpp
@@ -26,6 +26,11 @@
 #error This header may not be used when targeting libc++
 #endif
 
+// Indicates that we are using the MSVC standard library.
+#ifndef _MSVC_STL_VER
+#define _MSVC_STL_VER 42
+#endif
+
 struct AssertionDialogAvoider {
 AssertionDialogAvoider() {
 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
Index: test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
===
--- test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
+++ test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
@@ -22,6 +22,7 @@
 #include 
 
 #include "test_macros.h"
+#include "test_workarounds.h"
 
 struct ThrowsMove {
   ThrowsMove(ThrowsMove &&) noexcept(false) {}
@@ -178,20 +179,48 @@
 }
 
 void test_constexpr_move_ctor_extension() {
-#ifdef _LIBCPP_VERSION
+#if defined(_LIBCPP_VER) || defined(_MSVC_STL_VER)
   using V = std::variant;
+#ifdef TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
+  static_assert(std::is_trivially_destructible::value, "");
+  static_assert(std::is_trivially_copy_constructible::value, "");
+  static_assert(std::is_trivially_move_constructible::value, "");
+  static_assert(!std::is_copy_assignable::value, "");
+  static_assert(!std::is_move_assignable::value, "");
+#else
   static_assert(std::is_trivially_copyable::value, "");
+#endif
   static_assert(std::is_trivially_move_constructible::value, "");
   static_assert(test_constexpr_ctor_extension_imp<0>(V(42l)), "");
   static_assert(test_constexpr_ctor_extension_imp<1>(V(nullptr)), "");
   static_assert(test_constexpr_ctor_extension_imp<2>(V(101)), "");
 #endif
 }
 
+template
+constexpr bool triviality_test =
+  std::is_trivially_move_constructible::value ==
+std::conjunction::value;
+
+void test_triviality_extension() {
+#if defined(_MSVC_STL_VER)
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+  static_assert(triviality_test, "");
+