Skip to content

Commit 46db91e

Browse files
Merge pull request #4328 from robert-shade:suppress_unreachable_warning
PiperOrigin-RevId: 554578443 Change-Id: Ib5b03605c30fc2974b9597860577ff89532eedcd
2 parents 6abc9e3 + 429432e commit 46db91e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

googlemock/include/gmock/gmock-actions.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,15 @@ struct BuiltInDefaultValueGetter<T, false> {
175175
static T Get() {
176176
Assert(false, __FILE__, __LINE__,
177177
"Default action undefined for the function return type.");
178-
return internal::Invalid<T>();
178+
#if defined(__GNUC__) || defined(__clang__)
179+
__builtin_unreachable();
180+
#elif defined(_MSC_VER)
181+
__assume(0);
182+
#else
183+
return Invalid<T>();
179184
// The above statement will never be reached, but is required in
180185
// order for this function to compile.
186+
#endif
181187
}
182188
};
183189

0 commit comments

Comments
 (0)