[ADT] Avoid use of result_of_t in function_ref
authorSam McCall <sam.mccall@gmail.com>
Mon, 19 Oct 2020 12:58:31 +0000 (14:58 +0200)
committerSam McCall <sam.mccall@gmail.com>
Mon, 19 Oct 2020 12:59:45 +0000 (14:59 +0200)
It has bugs on some old libc++ versions and we don't need the power.
See https://reviews.llvm.org/D88977

llvm/include/llvm/ADT/STLExtras.h

index 0d18164..f3f9f20 100644 (file)
@@ -199,9 +199,9 @@ public:
                         function_ref>::value> * = nullptr,
       // Functor must be callable and return a suitable type.
       std::enable_if_t<std::is_void<Ret>::value ||
-                       std::is_convertible<
-                           std::result_of_t<Callable(Params...)>, Ret>::value>
-          * = nullptr)
+                       std::is_convertible<decltype(std::declval<Callable>()(
+                                               std::declval<Params>()...)),
+                                           Ret>::value> * = nullptr)
       : callback(callback_fn<typename std::remove_reference<Callable>::type>),
         callable(reinterpret_cast<intptr_t>(&callable)) {}