diff options
author | Copybara-Service <copybara-worker@google.com> | 2023-08-07 20:39:47 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-08-07 20:39:47 (GMT) |
commit | 46db91ef6ffcc128b2d5f31118ae1108109e3400 (patch) | |
tree | 74abae102af14c85b0ab565c702001774037d2e4 | |
parent | 6abc9e3d791ecac53361832bc4c14b6203daff4b (diff) | |
parent | 429432e341b3d68a8a9be079e739a587d41b48b8 (diff) | |
download | googletest-46db91ef6ffcc128b2d5f31118ae1108109e3400.zip googletest-46db91ef6ffcc128b2d5f31118ae1108109e3400.tar.gz googletest-46db91ef6ffcc128b2d5f31118ae1108109e3400.tar.bz2 |
Merge pull request #4328 from robert-shade:suppress_unreachable_warning
PiperOrigin-RevId: 554578443
Change-Id: Ib5b03605c30fc2974b9597860577ff89532eedcd
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index bd9ba73..f20258b 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -175,9 +175,15 @@ struct BuiltInDefaultValueGetter<T, false> { static T Get() { Assert(false, __FILE__, __LINE__, "Default action undefined for the function return type."); - return internal::Invalid<T>(); +#if defined(__GNUC__) || defined(__clang__) + __builtin_unreachable(); +#elif defined(_MSC_VER) + __assume(0); +#else + return Invalid<T>(); // The above statement will never be reached, but is required in // order for this function to compile. +#endif } }; |