In C++03 mode add an explicit conversion from int to the emulated class enum. Fixes a problem reported by C. Bergström.

llvm-svn: 162189
This commit is contained in:
Howard Hinnant 2012-08-19 17:14:47 +00:00
parent e4b2a743b8
commit a3b7a802cc
1 changed files with 2 additions and 0 deletions

View File

@ -276,6 +276,7 @@ namespace std {
#elif defined(__GNUC__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
#define _LIBCPP_NORETURN __attribute__((noreturn))
@ -412,6 +413,7 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
_ __v_; \
_LIBCPP_ALWAYS_INLINE x(_ __v) : __v_(__v) {} \
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<_>(__v)) {} \
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
};
#else // _LIBCPP_HAS_NO_STRONG_ENUMS