Fixed MSVC unreachable warning. (#431)

This commit is contained in:
Branimir Karadžić
2026-09-27 08:46:59 -07:00
committed by GitHub
parent 2531549884
commit 3d6e53107b

View File

@@ -298,6 +298,8 @@ namespace bx
return static_cast<Ty>(_from);
}
BX_PRAGMA_DIAGNOSTIC_PUSH()
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4702) // warning C4702: unreachable code
template<typename Ty, typename FromT>
inline constexpr bool narrowCastTest(Ty* _out, const FromT& _from)
{
@@ -307,12 +309,10 @@ namespace bx
return true;
}
BX_PRAGMA_DIAGNOSTIC_PUSH()
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4702) // warning C4702: unreachable code
*_out = static_cast<Ty>(_from);
return static_cast<FromT>(*_out) == _from;
BX_PRAGMA_DIAGNOSTIC_POP()
}
BX_PRAGMA_DIAGNOSTIC_POP()
template<typename Ty, typename FromT>
inline Ty narrowCast(const FromT& _from, Location _location)