googletest/googletest/include/gtest
Nico Weber b2cbbec04c Fix -Wmicrosoft-cast warnings when using gtest with clang on Windows.
This upstreams a Google-internal change.

Original CL description:
The C++ standard says that function pointers are not implicitly
convertible to object pointers. Visual Studio disregards that and allows
implicit conversion between function pointers and object points, and
enough code relies on this that clang follows suit in
Microsoft-compatibility mode.

However, clang emits a -Wmicrosoft-cast warning when such a conversion
is done:

E:\b\c\b\win_clang\src\sandbox\win\src\sync_dispatcher.cc(42,7):
    warning: implicit conversion between pointer-to-function and
             pointer-to-object is a Microsoft extension [-Wmicrosoft-cast]

This change fixes this warning in gtest, while hopefully not changing
any behavior. The change does two things:

1. It replaces the if in DefaultPrintTo with SFINAE
2. In C++11 mode, it uses enable_if<is_function<>> instead of
   ImplicitlyConvertible<T*, const void*> to check if the
   explicit cast is needed.

With this change, functions will use the branch with the reintpret_casts
with Visual Studio and clang/win, and clang no longer needs to warn
that it implicitly converts a function pointer to a void pointer.
2017-05-15 17:21:25 -04:00
..
internal Merge pull request #1078 from pwnall/gtest_api_port 2017-05-10 22:10:01 -04:00
gtest_pred_impl.h Move everything in googletest into googletest/googletest 2015-08-25 16:18:00 -04:00
gtest_prod.h Move everything in googletest into googletest/googletest 2015-08-25 16:18:00 -04:00
gtest-death-test.h Move everything in googletest into googletest/googletest 2015-08-25 16:18:00 -04:00
gtest-message.h Move everything in googletest into googletest/googletest 2015-08-25 16:18:00 -04:00
gtest-param-test.h Move everything in googletest into googletest/googletest 2015-08-25 16:18:00 -04:00
gtest-param-test.h.pump Move everything in googletest into googletest/googletest 2015-08-25 16:18:00 -04:00
gtest-printers.h Fix -Wmicrosoft-cast warnings when using gtest with clang on Windows. 2017-05-15 17:21:25 -04:00
gtest-spi.h Move everything in googletest into googletest/googletest 2015-08-25 16:18:00 -04:00
gtest-test-part.h Move everything in googletest into googletest/googletest 2015-08-25 16:18:00 -04:00
gtest-typed-test.h fix typo /GTEST_ATTRIBUTE_UNUSED/GTEST_ATTRIBUTE_UNUSED_/ 2017-02-03 08:05:22 +09:00
gtest.h Changes to make TempDir() public 2017-05-02 14:16:11 -04:00