summaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-actions.h
diff options
context:
space:
mode:
authorRobert Shade <robert.shade@gmail.com>2023-08-02 18:09:54 (GMT)
committerRobert Shade <robert.shade@gmail.com>2023-08-02 18:09:54 (GMT)
commit429432e341b3d68a8a9be079e739a587d41b48b8 (patch)
tree29b4e2f0dbcb881843607c75579cc4b01f705623 /googlemock/include/gmock/gmock-actions.h
parent843976e4f582ccb76cf87e0f128585324335779b (diff)
downloadgoogletest-429432e341b3d68a8a9be079e739a587d41b48b8.zip
googletest-429432e341b3d68a8a9be079e739a587d41b48b8.tar.gz
googletest-429432e341b3d68a8a9be079e739a587d41b48b8.tar.bz2
Avoid unreachable code warningrefs/pull/4328/head
Diffstat (limited to 'googlemock/include/gmock/gmock-actions.h')
-rw-r--r--googlemock/include/gmock/gmock-actions.h8
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
}
};