mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 869194 - CheckedInt should consistently reject unsupported types - r=Waldo
This commit is contained in:
parent
b6ecd61d8f
commit
3701ad32bf
@ -561,7 +561,8 @@ class CheckedInt
|
||||
template<typename U>
|
||||
CheckedInt(U value, bool isValid) : mValue(value), mIsValid(isValid)
|
||||
{
|
||||
MOZ_STATIC_ASSERT(detail::IsSupported<T>::value,
|
||||
MOZ_STATIC_ASSERT(detail::IsSupported<T>::value &&
|
||||
detail::IsSupported<U>::value,
|
||||
"This type is not supported by CheckedInt");
|
||||
}
|
||||
|
||||
@ -584,7 +585,8 @@ class CheckedInt
|
||||
: mValue(T(value)),
|
||||
mIsValid(detail::IsInRange<T>(value))
|
||||
{
|
||||
MOZ_STATIC_ASSERT(detail::IsSupported<T>::value,
|
||||
MOZ_STATIC_ASSERT(detail::IsSupported<T>::value &&
|
||||
detail::IsSupported<U>::value,
|
||||
"This type is not supported by CheckedInt");
|
||||
}
|
||||
|
||||
@ -755,6 +757,9 @@ template<typename T, typename U>
|
||||
inline typename detail::CastToCheckedIntImpl<T, U>::ReturnType
|
||||
castToCheckedInt(U u)
|
||||
{
|
||||
MOZ_STATIC_ASSERT(detail::IsSupported<T>::value &&
|
||||
detail::IsSupported<U>::value,
|
||||
"This type is not supported by CheckedInt");
|
||||
return detail::CastToCheckedIntImpl<T, U>::run(u);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user