[libcxx] r276589 - Work around MSVC's non-standard ABI for enums. Patch from STL at microsoft.com
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 24 17:02:23 PDT 2016
Author: ericwf
Date: Sun Jul 24 19:02:23 2016
New Revision: 276589
URL: http://llvm.org/viewvc/llvm-project?rev=276589&view=rev
Log:
Work around MSVC's non-standard ABI for enums. Patch from STL at microsoft.com
Modified:
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp?rev=276589&r1=276588&r2=276589&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp Sun Jul 24 19:02:23 2016
@@ -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
Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp?rev=276589&r1=276588&r2=276589&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp Sun Jul 24 19:02:23 2016
@@ -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
Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp?rev=276589&r1=276588&r2=276589&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp Sun Jul 24 19:02:23 2016
@@ -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
More information about the cfe-commits
mailing list