PR77998 Remove std::thread::_Invoker::result_type
authorJonathan Wakely <jwakely@redhat.com>
Mon, 17 Oct 2016 12:23:09 +0000 (13:23 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 17 Oct 2016 12:23:09 +0000 (13:23 +0100)
PR libstdc++/77998
* include/std/future (__future_base::_Deferred_state)
(__future_base::_Async_state_impl): Use decltype to deduce return
type, instead of _Invoker::result_type.
* include/std/thread (thread::_Invoker::operator()): Likewise.
(thread::_Invoker::result_type): Remove.

From-SVN: r241236

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/future
libstdc++-v3/include/std/thread

index ed572815d6447bc82932431a121f0ff1261ba276..31280a36acffcff0b33744cd4fe9d2b8e4a5b801 100644 (file)
@@ -1,5 +1,12 @@
 2016-10-17  Jonathan Wakely  <jwakely@redhat.com>
 
+       PR libstdc++/77998
+       * include/std/future (__future_base::_Deferred_state)
+       (__future_base::_Async_state_impl): Use decltype to deduce return
+       type, instead of _Invoker::result_type.
+       * include/std/thread (thread::_Invoker::operator()): Likewise.
+       (thread::_Invoker::result_type): Remove.
+
        PR libstdc++/77987
        * include/bits/unique_ptr.h (unique_ptr<T[], D>::reset<U>(U)): Copy
        value to pointer of the correct type to swap, to support conversions
index 31a21f976eed4126bce1f16fd9e24d79eb1ea8dd..5542d49584ff6ff0de383d311a469947da1942a0 100644 (file)
@@ -561,10 +561,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     class _Async_state_commonV2;
 #endif
 
-    template<typename _BoundFn, typename = typename _BoundFn::result_type>
+    template<typename _BoundFn,
+            typename _Res = decltype(std::declval<_BoundFn&>()())>
       class _Deferred_state;
 
-    template<typename _BoundFn, typename = typename _BoundFn::result_type>
+    template<typename _BoundFn,
+            typename _Res = decltype(std::declval<_BoundFn&>()())>
       class _Async_state_impl;
 
     template<typename _Signature>
index 7a3c4078cc123c5df28c8621112642e0f7b4072f..576e5776e6ef61b7d367f5f1e0f72339bf03a693 100644 (file)
@@ -235,14 +235,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        using _Indices
          = typename _Build_index_tuple<tuple_size<_Tuple>::value>::__type;
 
-       using result_type
-         = decltype(std::declval<_Invoker>()._M_invoke(_Indices()));
-
-       result_type
+       auto
        operator()()
-       noexcept(noexcept(std::declval<_Invoker>()._M_invoke(_Indices())))
+       noexcept(noexcept(std::declval<_Invoker&>()._M_invoke(_Indices())))
+       -> decltype(std::declval<_Invoker&>()._M_invoke(_Indices()))
        { return _M_invoke(_Indices()); }
-
       };
 
     // Alias for _Invoker<tuple<DECAY_COPY(_Tp)...>>