[llvm] 375f7a4 - [ADT] Avoid use of result_of_t in function_ref

Sam McCall via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 05:59:59 PDT 2020


Author: Sam McCall
Date: 2020-10-19T14:59:45+02:00
New Revision: 375f7a416031b3a011a5a88ba5f80f5879d775ca

URL: https://github.com/llvm/llvm-project/commit/375f7a416031b3a011a5a88ba5f80f5879d775ca
DIFF: https://github.com/llvm/llvm-project/commit/375f7a416031b3a011a5a88ba5f80f5879d775ca.diff

LOG: [ADT] Avoid use of result_of_t in function_ref

It has bugs on some old libc++ versions and we don't need the power.
See https://reviews.llvm.org/D88977

Added: 
    

Modified: 
    llvm/include/llvm/ADT/STLExtras.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 0d18164bcce5..f3f9f20dd4b5 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -199,9 +199,9 @@ class function_ref<Ret(Params...)> {
                         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)) {}
 


        


More information about the llvm-commits mailing list