From d00b43c592eecb69d46210ec24968ab30ea330f7 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 14 May 2016 17:58:14 -0700 Subject: [PATCH] Workaround an issue with "delete this" in GMock and gcc 6.1.1 --- test/gmock/gmock.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/gmock/gmock.h b/test/gmock/gmock.h index 17bde1e..84f58cd 100644 --- a/test/gmock/gmock.h +++ b/test/gmock/gmock.h @@ -10090,8 +10090,9 @@ class FunctionMockerBase : public UntypedFunctionMockerBase { // threads concurrently. Result InvokeWith(const ArgumentTuple& args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - return static_cast( - this->UntypedInvokeWith(&args))->GetValueAndDelete(); + const ResultHolder *rh = static_cast( + this->UntypedInvokeWith(&args)); + return rh ? rh->GetValueAndDelete() : Result(); } // Adds and returns a default action spec for this mock function.