mirror of
https://github.com/google/googletest.git
synced 2025-12-24 04:24:54 +08:00
Fix emission of -Wzero-as-null-pointer-constant when comparing integers.
The following code fails to compile:
#pragma clang diagnostic error "-Wzero-as-null-pointer-constant"
void foo() {
EXPECT_EQ(0, 0);
}
This happens because gtest checks the first argument to EXPECT_EQ and
ASSERT_EQ is a null pointer constant. The magic it does to do this causes the
warning to be emitted.
This patch removes that check. It replaces the explicit check with a Compare
overload that can only be selected when 0 or nullptr is passed on the LHS
with a pointer on the right.
This patch does not suppress -Wzero-as-null-pointer-constant when users
are actually using it as NULL.
PiperOrigin-RevId: 236654634
|
||
|---|---|---|
| .. | ||
| custom | ||
| gtest-death-test-internal.h | ||
| gtest-filepath.h | ||
| gtest-internal.h | ||
| gtest-param-util.h | ||
| gtest-port-arch.h | ||
| gtest-port.h | ||
| gtest-string.h | ||
| gtest-type-util.h | ||
| gtest-type-util.h.pump | ||