logging: Provide a specific MakeCheckOpValueString overload for functions
So far, passing a function or function pointer to a check such as DCHECK_EQ
would cause the values to be implicitly converted to bool, resulting in a
confusing message like this
Check failed: x == y (1 vs. 1)
instead of
Check failed: x == y (0x779410 vs. 0x778fe0)
Add a specific overload for functions and function pointers that explicitly
cast them to const void* to have them call the right operator<< overload.
This fixes warnings on both new GCC versions (-Waddress complains that passing a function or function pointer to operator<< would always become '1') and clang on Windows (see https://bugs.chromium.org/p/chromium/issues/detail?id=550065#c12).
BUG=550065
R=danakj@chromium.org,thakis@chromium.org,jbroman@chromium.org
Review-Url: https://codereview.chromium.org/2515283002
Cr-Commit-Position: refs/heads/master@{#434702}
Showing
Please register or sign in to comment