From 373af2e3df71599b87a40ce0e37164523849166b Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 28 Jul 2025 11:13:06 -0700 Subject: [PATCH] Provide a better error message when ASSERT and SKIP macros are used in methods that return values PiperOrigin-RevId: 788083860 Change-Id: I91583f0c0f816144428d56ab07e58fd035c532d1 --- googletest/include/gtest/gtest.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index cbe680c1a..69994ee9d 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -1610,6 +1610,8 @@ GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1, double val1, double val2, double abs_error); +using GoogleTest_NotSupported_OnFunctionReturningNonVoid = void; + // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // A class that enables one to stream messages to assertion macros class GTEST_API_ AssertHelper { @@ -1621,7 +1623,8 @@ class GTEST_API_ AssertHelper { // Message assignment is a semantic trick to enable assertion // streaming; see the GTEST_MESSAGE_ macro below. - void operator=(const Message& message) const; + GoogleTest_NotSupported_OnFunctionReturningNonVoid operator=( + const Message& message) const; private: // We put our data in a struct so that the size of the AssertHelper class can