aboutsummaryrefslogtreecommitdiffstats
path: root/include/gmock/gmock-printers.h
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2009-09-24 16:39:30 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2009-09-24 16:39:30 +0000
commitf47a2df57bd83291e69ece23b0d5b480fbb90bbf (patch)
tree5c765f000a60b1e058b451855fcff014bb82ded6 /include/gmock/gmock-printers.h
parenta89034c8021ea6e55bf55688eeb99065de9de928 (diff)
downloadgoogletest-f47a2df57bd83291e69ece23b0d5b480fbb90bbf.tar.gz
googletest-f47a2df57bd83291e69ece23b0d5b480fbb90bbf.tar.bz2
googletest-f47a2df57bd83291e69ece23b0d5b480fbb90bbf.zip
Makes gmock compile on minGW, which uses gcc 3.4.5.
Diffstat (limited to 'include/gmock/gmock-printers.h')
-rw-r--r--include/gmock/gmock-printers.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/gmock/gmock-printers.h b/include/gmock/gmock-printers.h
index 69eee120..e07d92af 100644
--- a/include/gmock/gmock-printers.h
+++ b/include/gmock/gmock-printers.h
@@ -279,9 +279,12 @@ void DefaultPrintTo(IsNotContainer /* dummy */,
if (p == NULL) {
*os << "NULL";
} else {
- // We cannot use implicit_cast or static_cast here, as they don't
- // work when p is a function pointer.
- *os << reinterpret_cast<const void*>(p);
+ // We want to print p as a const void*. However, we cannot cast
+ // it to const void* directly, even using reinterpret_cast, as
+ // earlier versions of gcc (e.g. 3.4.5) cannot compile the cast
+ // when p is a function pointer. Casting to UInt64 first solves
+ // the problem.
+ *os << reinterpret_cast<const void*>(reinterpret_cast<internal::UInt64>(p));
}
}