Avoid triggering -Wzero-as-null-pointer-constant in HandleExceptionsInMethodIfSupported() Fixes: #2916 PiperOrigin-RevId: 953422776 Change-Id: Ic5a167e93d611adb184c516a6383dcc119e11fd7
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 92ea581..55a68c0 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc
@@ -2700,7 +2700,7 @@ } // Runs the given method and catches and reports C++ and/or SEH-style -// exceptions, if they are supported; returns the 0-value for type +// exceptions, if they are supported; returns the default-value for type // Result in case of an SEH exception. template <class T, typename Result> Result HandleExceptionsInMethodIfSupported(T* object, Result (T::*method)(), @@ -2748,7 +2748,7 @@ TestPartResult::kFatalFailure, FormatCxxExceptionMessage(nullptr, location)); } - return static_cast<Result>(0); + return Result(); #else return HandleSehExceptionsInMethodIfSupported(object, method, location); #endif // GTEST_HAS_EXCEPTIONS