aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/docs/DevGuide.md
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2017-05-15 17:21:25 -0400
committerNico Weber <thakis@chromium.org>2017-05-15 17:21:25 -0400
commitb2cbbec04c141801dc9f648dc92b26bac5bad0da (patch)
treeae7c03161abb3cb7c84bee822693a3ebf9ea6c18 /googlemock/docs/DevGuide.md
parent294f72bc773c92410aa3c5ecdd6cd4a757c3fbf4 (diff)
downloadgoogletest-b2cbbec04c141801dc9f648dc92b26bac5bad0da.tar.gz
googletest-b2cbbec04c141801dc9f648dc92b26bac5bad0da.tar.bz2
googletest-b2cbbec04c141801dc9f648dc92b26bac5bad0da.zip
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.
Diffstat (limited to 'googlemock/docs/DevGuide.md')
0 files changed, 0 insertions, 0 deletions