LWG Issue 2097: packaged_task constructors should be constrained
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192544 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/future b/include/future
index 334eaeb..2d969df 100644
--- a/include/future
+++ b/include/future
@@ -2013,10 +2013,26 @@
// construction and destruction
_LIBCPP_INLINE_VISIBILITY
packaged_task() _NOEXCEPT : __p_(nullptr) {}
- template <class _Fp>
+ template <class _Fp,
+ class = typename enable_if
+ <
+ !is_same<
+ typename decay<_Fp>::type,
+ packaged_task
+ >::value
+ >::type
+ >
_LIBCPP_INLINE_VISIBILITY
explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
- template <class _Fp, class _Allocator>
+ template <class _Fp, class _Allocator,
+ class = typename enable_if
+ <
+ !is_same<
+ typename decay<_Fp>::type,
+ packaged_task
+ >::value
+ >::type
+ >
_LIBCPP_INLINE_VISIBILITY
explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
: __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
@@ -2128,10 +2144,26 @@
// construction and destruction
_LIBCPP_INLINE_VISIBILITY
packaged_task() _NOEXCEPT : __p_(nullptr) {}
- template <class _Fp>
+ template <class _Fp,
+ class = typename enable_if
+ <
+ !is_same<
+ typename decay<_Fp>::type,
+ packaged_task
+ >::value
+ >::type
+ >
_LIBCPP_INLINE_VISIBILITY
explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
- template <class _Fp, class _Allocator>
+ template <class _Fp, class _Allocator,
+ class = typename enable_if
+ <
+ !is_same<
+ typename decay<_Fp>::type,
+ packaged_task
+ >::value
+ >::type
+ >
_LIBCPP_INLINE_VISIBILITY
explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
: __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),