diff options
| author | Eric Fiselier <eric@efcs.ca> | 2016-07-25 00:02:23 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2016-07-25 00:02:23 +0000 |
| commit | b8937d64541667809b84859b7315506e4f4c1df5 (patch) | |
| tree | 6b92004a9c7a08d23783da3ee60a902a37e49ab9 /libcxx | |
| parent | 44b4f6b85c8923de1eb65e803ae702c2a9588a35 (diff) | |
| download | bcm5719-llvm-b8937d64541667809b84859b7315506e4f4c1df5.tar.gz bcm5719-llvm-b8937d64541667809b84859b7315506e4f4c1df5.zip | |
Work around MSVC's non-standard ABI for enums. Patch from STL@microsoft.com
llvm-svn: 276589
Diffstat (limited to 'libcxx')
3 files changed, 22 insertions, 5 deletions
diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp index 1d7b23c1922..452b8517479 100644 --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp @@ -21,14 +21,19 @@ enum F { W = UINT_MAX }; int main() { +#if !defined(_WIN32) || defined(__MINGW32__) + typedef unsigned ExpectUnsigned; +#else + typedef int ExpectUnsigned; // MSVC's ABI doesn't follow the Standard +#endif static_assert((std::is_same<std::underlying_type<E>::type, int>::value), "E has the wrong underlying type"); - static_assert((std::is_same<std::underlying_type<F>::type, unsigned>::value), - "F has the wrong underlying type"); + static_assert((std::is_same<std::underlying_type<F>::type, ExpectUnsigned>::value), + "F has the wrong underlying type"); -#if _LIBCPP_STD_VER > 11 +#if TEST_STD_VER > 11 static_assert((std::is_same<std::underlying_type_t<E>, int>::value), ""); - static_assert((std::is_same<std::underlying_type_t<F>, unsigned>::value), ""); + static_assert((std::is_same<std::underlying_type_t<F>, ExpectUnsigned>::value), ""); #endif #if TEST_STD_VER >= 11 @@ -36,7 +41,7 @@ int main() static_assert((std::is_same<std::underlying_type<G>::type, char>::value), "G has the wrong underlying type"); -#if _LIBCPP_STD_VER > 11 +#if TEST_STD_VER > 11 static_assert((std::is_same<std::underlying_type_t<G>, char>::value), ""); #endif #endif // TEST_STD_VER >= 11 diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp index eb8e31c76e1..069202062e9 100644 --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp @@ -13,9 +13,15 @@ #include <type_traits> +#include "test_macros.h" + enum Enum {zero, one_}; +#if TEST_STD_VER >= 11 +enum BigEnum : unsigned long long // MSVC's ABI doesn't follow the Standard +#else enum BigEnum +#endif { bigzero, big = 0xFFFFFFFFFFFFFFFFULL diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp index 984440193fa..41ffdaa72b8 100644 --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp @@ -13,9 +13,15 @@ #include <type_traits> +#include "test_macros.h" + enum Enum {zero, one_}; +#if TEST_STD_VER >= 11 +enum BigEnum : unsigned long long // MSVC's ABI doesn't follow the Standard +#else enum BigEnum +#endif { bigzero, big = 0xFFFFFFFFFFFFFFFFULL |

