diff options
author | David Benjamin <davidben@google.com> | 2017-01-20 17:54:07 (GMT) |
---|---|---|
committer | David Benjamin <davidben@google.com> | 2017-08-07 18:56:40 (GMT) |
commit | ca6a70c6082ff526b993c622d192c6d519800bc2 (patch) | |
tree | 73f063cd7305c8ff214f8ee35ab61495bb5a7713 /googletest | |
parent | eb261b4dce67b7d4cf1b77e8c14b1c4bac260843 (diff) | |
download | googletest-ca6a70c6082ff526b993c622d192c6d519800bc2.zip googletest-ca6a70c6082ff526b993c622d192c6d519800bc2.tar.gz googletest-ca6a70c6082ff526b993c622d192c6d519800bc2.tar.bz2 |
Pass MSVC's C4826 warning.
MSVC has an optional warning which flags when 32-bit pointers get cast
into a 64-bit value. This is a little overaggressive I think, but to
ease compiling in projects with aggressive warnings, fix this by just
casting to const void * directly. Modern GCCs seem to compile it just
fine.
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/include/gtest/gtest-printers.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index e850d60..c6f69fa 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -426,13 +426,8 @@ void DefaultPrintTo(WrapPrinterType<kPrintFunctionPointer> /* dummy */, *os << "NULL"; } else { // T is a function type, so '*os << p' doesn't do what we want - // (it just prints p as bool). 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)); + // (it just prints p as bool). Cast p to const void* to print it. + *os << reinterpret_cast<const void*>(p); } } |