From e2163a62552f0c6b8e61067f2b31c7275a17fc1d Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Thu, 24 Sep 2009 16:39:30 +0000 Subject: Makes gmock compile on minGW, which uses gcc 3.4.5. git-svn-id: http://googlemock.googlecode.com/svn/trunk@207 8415998a-534a-0410-bf83-d39667b30386 --- include/gmock/gmock-printers.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/gmock/gmock-printers.h b/include/gmock/gmock-printers.h index 69eee12..e07d92a 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(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(reinterpret_cast(p)); } } -- cgit v1.2.1