Replace infinite recursion call (intentionally invoking undefined behavior to indicate unreachability) with explicit unreachability marker.
PiperOrigin-RevId: 441474979 Change-Id: I1fcbb437026631212fec954c663482bb7e1cf819
This commit is contained in:
parent
a1cc8c5519
commit
733f875989
@ -305,10 +305,13 @@ GTEST_API_ WithoutMatchers GetWithoutMatchers();
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline T Invalid() {
|
inline T Invalid() {
|
||||||
Assert(false, "", -1, "Internal error: attempt to return invalid value");
|
Assert(false, "", -1, "Internal error: attempt to return invalid value");
|
||||||
// This statement is unreachable, and would never terminate even if it
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
// could be reached. It is provided only to placate compiler warnings
|
__builtin_unreachable();
|
||||||
// about missing return statements.
|
#elif defined(_MSC_VER)
|
||||||
|
__assume(0);
|
||||||
|
#else
|
||||||
return Invalid<T>();
|
return Invalid<T>();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
Loading…
Reference in New Issue
Block a user