author | Benoit Jacob <bjacob@mozilla.com> |
Wed, 08 May 2013 17:25:15 -0400 | |
changeset 142254 | e725c1aa589dffc580c10d59829ae3a2673285bc |
parent 142253 | 9a8c7cd83f2293987e36b1103e07d29c0263844d |
child 142255 | 7dcb2e0f454b35b78412188cc957f39e2c016d76 |
push id | 2579 |
push user | akeybl@mozilla.com |
push date | Mon, 24 Jun 2013 18:52:47 +0000 |
treeherder | mozilla-beta@b69b7de8a05a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | Waldo |
bugs | 869194 |
milestone | 23.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
mfbt/CheckedInt.h | file | annotate | diff | comparison | revisions |
--- a/mfbt/CheckedInt.h +++ b/mfbt/CheckedInt.h @@ -556,17 +556,18 @@ class CheckedInt { protected: T mValue; bool mIsValid; 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"); } friend class detail::NegateImpl<T>; public: /** * Constructs a checked integer with given @a value. The checked integer is @@ -579,17 +580,18 @@ class CheckedInt * documentation for class CheckedInt, this constructor checks that its * argument is valid. */ template<typename U> CheckedInt(U value) : 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"); } /** Constructs a valid checked integer with initial value 0 */ CheckedInt() : mValue(0), mIsValid(true) { MOZ_STATIC_ASSERT(detail::IsSupported<T>::value, "This type is not supported by CheckedInt"); @@ -750,16 +752,19 @@ struct CastToCheckedIntImpl<T, CheckedIn }; } // namespace detail 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); } #define MOZ_CHECKEDINT_CONVENIENCE_BINARY_OPERATORS(OP, COMPOUND_OP) \ template<typename T> \ template<typename U> \ CheckedInt<T>& CheckedInt<T>::operator COMPOUND_OP(U rhs) \ { \