Add operators to make launch a bitmask type. Searched all of the standard, and libc++ to see if this error occurred elsewhere and didn't see any other place. This fixes http://llvm.org/bugs/show_bug.cgi?id=16207

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185265 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2013-06-29 18:38:17 +00:00
parent ab135d7f4e
commit f491e51ebd
2 changed files with 82 additions and 0 deletions

View File

@@ -403,6 +403,72 @@ _LIBCPP_DECLARE_STRONG_ENUM(launch)
};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
#ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
#ifdef _LIBCXX_UNDERLYING_TYPE
typedef underlying_type<launch>::type __launch_underlying_type;
#else
typedef int __launch_underlying_type;
#endif
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
launch
operator&(launch __x, launch __y)
{
return static_cast<launch>(static_cast<__launch_underlying_type>(__x) &
static_cast<__launch_underlying_type>(__y));
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
launch
operator|(launch __x, launch __y)
{
return static_cast<launch>(static_cast<__launch_underlying_type>(__x) |
static_cast<__launch_underlying_type>(__y));
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
launch
operator^(launch __x, launch __y)
{
return static_cast<launch>(static_cast<__launch_underlying_type>(__x) ^
static_cast<__launch_underlying_type>(__y));
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
launch
operator~(launch __x)
{
return static_cast<launch>(~static_cast<__launch_underlying_type>(__x));
}
inline _LIBCPP_INLINE_VISIBILITY
launch&
operator&=(launch& __x, launch __y)
{
__x = __x & __y; return __x;
}
inline _LIBCPP_INLINE_VISIBILITY
launch&
operator|=(launch& __x, launch __y)
{
__x = __x | __y; return __x;
}
inline _LIBCPP_INLINE_VISIBILITY
launch&
operator^=(launch& __x, launch __y)
{
__x = __x ^ __y; return __x;
}
#endif // !_LIBCPP_HAS_NO_STRONG_ENUMS
//enum class future_status
_LIBCPP_DECLARE_STRONG_ENUM(future_status)
{