summaryrefslogtreecommitdiffstats
path: root/googletest/test/gtest_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'googletest/test/gtest_unittest.cc')
-rw-r--r--googletest/test/gtest_unittest.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index dd049a0..6caa03f 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -67,11 +67,27 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
#include <string>
#include <type_traits>
#include <unordered_set>
+#include <utility>
#include <vector>
#include "gtest/gtest-spi.h"
#include "src/gtest-internal-inl.h"
+struct ConvertibleGlobalType {
+ // The inner enable_if is to ensure invoking is_constructible doesn't fail.
+ // The outer enable_if is to ensure the overload resolution doesn't encounter
+ // an ambiguity.
+ template <
+ class T,
+ std::enable_if_t<
+ false, std::enable_if_t<std::is_constructible<T>::value, int>> = 0>
+ operator T() const; // NOLINT(google-explicit-constructor)
+};
+void operator<<(ConvertibleGlobalType&, int);
+static_assert(sizeof(decltype(std::declval<ConvertibleGlobalType&>()
+ << 1)(*)()) > 0,
+ "error in operator<< overload resolution");
+
namespace testing {
namespace internal {