summaryrefslogtreecommitdiffstats
path: root/googletest/include/gtest/gtest-printers.h
diff options
context:
space:
mode:
Diffstat (limited to 'googletest/include/gtest/gtest-printers.h')
-rw-r--r--googletest/include/gtest/gtest-printers.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h
index 67c87f47..718e6f13 100644
--- a/googletest/include/gtest/gtest-printers.h
+++ b/googletest/include/gtest/gtest-printers.h
@@ -688,13 +688,20 @@ class UniversalPrinter<Any> {
public:
static void Print(const Any& value, ::std::ostream* os) {
if (value.has_value())
- *os << "'any' type with value of type " << GetTypeName();
+ *os << "'any' type with value of type " << GetTypeName(value);
else
*os << "'any' type with no value";
}
private:
- static std::string GetTypeName() { return "the element type"; }
+ static std::string GetTypeName(const Any& value) {
+#if GTEST_HAS_RTTI
+ return internal::GetTypeName(value.type());
+#else
+ static_cast<void>(value); // possibly unused
+ return "the element type";
+#endif // GTEST_HAS_RTTI
+ }
};
#endif // GTEST_INTERNAL_HAS_ANY
OpenPOWER on IntegriCloud