mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 18:38:30 +08:00
Work around MSVC's non-standard ABI for enums. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276589 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -21,14 +21,19 @@ enum F { W = UINT_MAX };
|
|||||||
|
|
||||||
int main()
|
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),
|
static_assert((std::is_same<std::underlying_type<E>::type, int>::value),
|
||||||
"E has the wrong underlying type");
|
"E has the wrong underlying type");
|
||||||
static_assert((std::is_same<std::underlying_type<F>::type, unsigned>::value),
|
static_assert((std::is_same<std::underlying_type<F>::type, ExpectUnsigned>::value),
|
||||||
"F has the wrong underlying type");
|
"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<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
|
#endif
|
||||||
|
|
||||||
#if TEST_STD_VER >= 11
|
#if TEST_STD_VER >= 11
|
||||||
@@ -36,7 +41,7 @@ int main()
|
|||||||
|
|
||||||
static_assert((std::is_same<std::underlying_type<G>::type, char>::value),
|
static_assert((std::is_same<std::underlying_type<G>::type, char>::value),
|
||||||
"G has the wrong underlying type");
|
"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), "");
|
static_assert((std::is_same<std::underlying_type_t<G>, char>::value), "");
|
||||||
#endif
|
#endif
|
||||||
#endif // TEST_STD_VER >= 11
|
#endif // TEST_STD_VER >= 11
|
||||||
|
@@ -13,9 +13,15 @@
|
|||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
enum Enum {zero, one_};
|
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
|
enum BigEnum
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
bigzero,
|
bigzero,
|
||||||
big = 0xFFFFFFFFFFFFFFFFULL
|
big = 0xFFFFFFFFFFFFFFFFULL
|
||||||
|
@@ -13,9 +13,15 @@
|
|||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
enum Enum {zero, one_};
|
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
|
enum BigEnum
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
bigzero,
|
bigzero,
|
||||||
big = 0xFFFFFFFFFFFFFFFFULL
|
big = 0xFFFFFFFFFFFFFFFFULL
|
||||||
|
Reference in New Issue
Block a user