Workaround an issue with "delete this" in GMock and gcc 6.1.1

This commit is contained in:
Victor Zverovich committed 2016-05-14 17:58:14 -07:00
1 parent cc9b051d12
commit d00b43c592
1 file changed
+3 -2
+3 -2
View File
@@ -10090,8 +10090,9 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// threads concurrently.
Result InvokeWith(const ArgumentTuple& args)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
return static_cast<const ResultHolder*>(
this->UntypedInvokeWith(&args))->GetValueAndDelete();
const ResultHolder *rh = static_cast<const ResultHolder*>(
this->UntypedInvokeWith(&args));
return rh ? rh->GetValueAndDelete() : Result();
}
// Adds and returns a default action spec for this mock function.