[llvm] r221763 - Fix non-variadic function_ref cases to match r221753

David Blaikie dblaikie at gmail.com
Tue Nov 11 19:28:57 PST 2014


Author: dblaikie
Date: Tue Nov 11 21:28:57 2014
New Revision: 221763

URL: http://llvm.org/viewvc/llvm-project?rev=221763&view=rev
Log:
Fix non-variadic function_ref cases to match r221753

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

Modified: llvm/trunk/include/llvm/ADT/STLExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=221763&r1=221762&r2=221763&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/STLExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/STLExtras.h Tue Nov 11 21:28:57 2014
@@ -103,7 +103,10 @@ class function_ref<Ret()> {
 
 public:
   template<typename Callable>
-  function_ref(Callable &&callable)
+  function_ref(Callable &&callable,
+               typename std::enable_if<
+                   !std::is_same<typename std::remove_reference<Callable>::type,
+                                 function_ref>::value>::type * = nullptr)
       : callback(callback_fn<typename std::remove_reference<Callable>::type>),
         callable(reinterpret_cast<intptr_t>(&callable)) {}
   Ret operator()() const { return callback(callable); }
@@ -122,7 +125,10 @@ class function_ref<Ret(Param1)> {
 
 public:
   template<typename Callable>
-  function_ref(Callable &&callable)
+  function_ref(Callable &&callable,
+               typename std::enable_if<
+                   !std::is_same<typename std::remove_reference<Callable>::type,
+                                 function_ref>::value>::type * = nullptr)
       : callback(callback_fn<typename std::remove_reference<Callable>::type>),
         callable(reinterpret_cast<intptr_t>(&callable)) {}
   Ret operator()(Param1 param1) {
@@ -144,7 +150,10 @@ class function_ref<Ret(Param1, Param2)>
 
 public:
   template<typename Callable>
-  function_ref(Callable &&callable)
+  function_ref(Callable &&callable,
+               typename std::enable_if<
+                   !std::is_same<typename std::remove_reference<Callable>::type,
+                                 function_ref>::value>::type * = nullptr)
       : callback(callback_fn<typename std::remove_reference<Callable>::type>),
         callable(reinterpret_cast<intptr_t>(&callable)) {}
   Ret operator()(Param1 param1, Param2 param2) {
@@ -170,7 +179,10 @@ class function_ref<Ret(Param1, Param2, P
 
 public:
   template<typename Callable>
-  function_ref(Callable &&callable)
+  function_ref(Callable &&callable,
+               typename std::enable_if<
+                   !std::is_same<typename std::remove_reference<Callable>::type,
+                                 function_ref>::value>::type * = nullptr)
       : callback(callback_fn<typename std::remove_reference<Callable>::type>),
         callable(reinterpret_cast<intptr_t>(&callable)) {}
   Ret operator()(Param1 param1, Param2 param2, Param3 param3) {





More information about the llvm-commits mailing list