mirror of
https://github.com/google/googletest.git
synced 2025-01-10 05:58:33 +08:00
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.
This commit is contained in:
parent
eb261b4dce
commit
ca6a70c608
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user