diff options
| author | Casey Carter <Casey@Carter.net> | 2017-05-04 15:32:54 +0000 | 
|---|---|---|
| committer | Casey Carter <Casey@Carter.net> | 2017-05-04 15:32:54 +0000 | 
| commit | 79053ff7953d848bf479fdc805f9e671264fbd82 (patch) | |
| tree | 3d06c3e7db92838f6215599a3639a843905b424a /libcxx/test/support | |
| parent | eedae7630aeb02d6d2184e511802e600764bcc23 (diff) | |
| download | bcm5719-llvm-79053ff7953d848bf479fdc805f9e671264fbd82.tar.gz bcm5719-llvm-79053ff7953d848bf479fdc805f9e671264fbd82.zip  | |
[test] variant: enable constexpr construction tests on MSVC STL
* Add a new macro _MSVC_STL_VER to detect when the MSVC STL is being tested
* Workaround C1XX __is_trivially_copyable bug
llvm-svn: 302158
Diffstat (limited to 'libcxx/test/support')
3 files changed, 37 insertions, 0 deletions
diff --git a/libcxx/test/support/msvc_stdlib_force_include.hpp b/libcxx/test/support/msvc_stdlib_force_include.hpp index 6cc867078f7..4ad8ae27aab 100644 --- a/libcxx/test/support/msvc_stdlib_force_include.hpp +++ b/libcxx/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); diff --git a/libcxx/test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp b/libcxx/test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp new file mode 100644 index 00000000000..4735417e67a --- /dev/null +++ b/libcxx/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 <type_traits> + +#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<S>::value, ""); +#else +  static_assert(std::is_trivially_copyable<S>::value, ""); +#endif +} diff --git a/libcxx/test/support/test_workarounds.h b/libcxx/test/support/test_workarounds.h index affdd102594..b24c883902e 100644 --- a/libcxx/test/support/test_workarounds.h +++ b/libcxx/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  | 

