Index: base/logging.h |
diff --git a/base/logging.h b/base/logging.h |
index 714545c02bb06ac7f1b31e8a007b671e6dc11d6d..22964cb3cfb546b55651d1912d12f364bf30e937 100644 |
--- a/base/logging.h |
+++ b/base/logging.h |
@@ -527,12 +527,24 @@ class CheckOpResult { |
// it uses the definition for operator<<, with a few special cases below. |
template <typename T> |
inline typename std::enable_if< |
- base::internal::SupportsOstreamOperator<const T&>::value, |
+ base::internal::SupportsOstreamOperator<const T&>::value && |
+ !std::is_function<typename std::remove_pointer<T>::type>::value, |
void>::type |
MakeCheckOpValueString(std::ostream* os, const T& v) { |
(*os) << v; |
} |
+// Provide an overload for functions and function pointers, which are otherwise |
+// implicitly converted to bool (MSVC seems to be the exception) and produce |
Nico
2016/11/23 18:09:26
This comment is a bit confusing as written. I'd re
|
+// unhelpful values. |
+template <typename T> |
+inline typename std::enable_if< |
+ std::is_function<typename std::remove_pointer<T>::type>::value, |
+ void>::type |
+MakeCheckOpValueString(std::ostream* os, const T& v) { |
+ (*os) << reinterpret_cast<const void*>(v); |
+} |
+ |
// We need overloads for enums that don't support operator<<. |
// (i.e. scoped enums where no operator<< overload was declared). |
template <typename T> |