STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits.
Work around MSVC's non-Standard ABI for enums. So this is definitely an MSVC bug, but one that's baked into our layout behavior, so even Clang has to enable it unconditionally when targeting Windows. In underlying_type.pass.cpp, I'm simply marking the affected static_asserts as libcxx-specific (this probably won't be sufficient when you try to get the Clang/LLVM/libcxx stack running on Windows). In make_signed.pass.cpp and make_unsigned.pass.cpp, I'm giving the enum an explicitly specified underlying type, so the tests below can remain unaffected. If there's a better way to do this, please let me know. I could give underlying_type.pass.cpp an explicitly specified underlying type, but I'm unsure as to how your C++03 tests work. http://reviews.llvm.org/D22017 Files: test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp Index: test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp =================================================================== --- test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp +++ 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 Index: test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp =================================================================== --- test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp +++ 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 Index: test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp =================================================================== --- test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp +++ test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp @@ -23,12 +23,12 @@ { 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"); + LIBCPP_STATIC_ASSERT((std::is_same<std::underlying_type<F>::type, unsigned>::value), + "F has the wrong underlying type"); // MSVC's ABI doesn't follow the Standard #if _LIBCPP_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), ""); + LIBCPP_STATIC_ASSERT((std::is_same<std::underlying_type_t<F>, unsigned>::value), ""); // MSVC's ABI #endif #if TEST_STD_VER >= 11
Index: test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp =================================================================== --- test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp +++ 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 Index: test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp =================================================================== --- test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp +++ 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 Index: test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp =================================================================== --- test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp +++ test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp @@ -23,12 +23,12 @@ { 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"); + LIBCPP_STATIC_ASSERT((std::is_same<std::underlying_type<F>::type, unsigned>::value), + "F has the wrong underlying type"); // MSVC's ABI doesn't follow the Standard #if _LIBCPP_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), ""); + LIBCPP_STATIC_ASSERT((std::is_same<std::underlying_type_t<F>, unsigned>::value), ""); // MSVC's ABI #endif #if TEST_STD_VER >= 11
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits