From 75689c1018ffcacb3d4771297f439822882313c6 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Fri, 2 Dec 2011 19:36:40 +0000 Subject: Fix http://llvm.org/bugs/show_bug.cgi?id=11428. Fix provided by Alberto Ganesh Barbati llvm-svn: 145698 --- libcxx/include/future | 42 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) (limited to 'libcxx/include/future') diff --git a/libcxx/include/future b/libcxx/include/future index 0e61869f278..aae707e1e4e 100644 --- a/libcxx/include/future +++ b/libcxx/include/future @@ -377,56 +377,40 @@ template struct uses_allocator, Alloc>; _LIBCPP_BEGIN_NAMESPACE_STD //enum class future_errc -struct _LIBCPP_VISIBLE future_errc +_LIBCPP_DECLARE_STRONG_ENUM(future_errc) { -enum _ { broken_promise, future_already_retrieved, promise_already_satisfied, no_state }; - - _ __v_; - - _LIBCPP_INLINE_VISIBILITY future_errc(_ __v) : __v_(__v) {} - _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} - -}; +_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_errc) template <> struct _LIBCPP_VISIBLE is_error_code_enum : public true_type {}; +#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS +template <> +struct _LIBCPP_VISIBLE is_error_code_enum : public true_type { }; +#endif + //enum class launch -struct _LIBCPP_VISIBLE launch +_LIBCPP_DECLARE_STRONG_ENUM(launch) { -enum _ { async = 1, deferred = 2, any = async | deferred }; - - _ __v_; - - _LIBCPP_INLINE_VISIBILITY launch(_ __v) : __v_(__v) {} - _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} - -}; +_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch) //enum class future_status -struct _LIBCPP_VISIBLE future_status +_LIBCPP_DECLARE_STRONG_ENUM(future_status) { -enum _ { ready, timeout, deferred }; - - _ __v_; - - _LIBCPP_INLINE_VISIBILITY future_status(_ __v) : __v_(__v) {} - _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} - -}; +_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_status) _LIBCPP_VISIBLE const error_category& future_category(); @@ -2252,10 +2236,10 @@ async(launch __policy, _Fp&& __f, _Args&&... __args) typedef __async_func::type, typename decay<_Args>::type...> _BF; typedef typename _BF::_Rp _Rp; future<_Rp> __r; - if (__policy & launch::async) + if (int(__policy) & int(launch::async)) __r = _VSTD::__make_async_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)), __decay_copy(_VSTD::forward<_Args>(__args))...)); - else if (__policy & launch::deferred) + else if (int(__policy) & int(launch::deferred)) __r = _VSTD::__make_deferred_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)), __decay_copy(_VSTD::forward<_Args>(__args))...)); return __r; -- cgit v1.2.3