Skip to content
Snippets Groups Projects
Commit 91324a3c authored by Ehsan Akhgari's avatar Ehsan Akhgari
Browse files

Bug 1188204 - Fix more constructors in MFBT; r=froydnj

parent 7a81d59c
No related branches found
No related tags found
No related merge requests found
......@@ -96,7 +96,7 @@ struct MOZ_MUST_USE already_AddRefed
* Note that nsRefPtr is the XPCOM reference counting smart pointer class.
*/
template <typename U>
already_AddRefed(already_AddRefed<U>&& aOther) : mRawPtr(aOther.take()) {}
MOZ_IMPLICIT already_AddRefed(already_AddRefed<U>&& aOther) : mRawPtr(aOther.take()) {}
~already_AddRefed() { MOZ_ASSERT(!mRawPtr); }
......
......@@ -526,7 +526,7 @@ public:
* argument is valid.
*/
template<typename U>
CheckedInt(U aValue) MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT
MOZ_IMPLICIT CheckedInt(U aValue) MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT
: mValue(T(aValue)),
mIsValid(detail::IsInRange<T>(aValue))
{
......
......@@ -36,7 +36,7 @@ public:
: mCurrent(aCurrent) { }
template<typename IntType, typename EnumType>
EnumeratedIterator(const EnumeratedIterator<IntType, EnumType>& aOther)
explicit EnumeratedIterator(const EnumeratedIterator<IntType, EnumType>& aOther)
: mCurrent(aOther.mCurrent) { }
EnumTypeT operator*() const { return mCurrent; }
......
......@@ -26,7 +26,7 @@ public:
: mCurrent(aCurrent) { }
template<typename IntType>
IntegerIterator(const IntegerIterator<IntType>& aOther)
explicit IntegerIterator(const IntegerIterator<IntType>& aOther)
: mCurrent(aOther.mCurrent) { }
IntTypeT operator*() const { return mCurrent; }
......
......@@ -104,7 +104,7 @@ public:
/* Equivalent to RangedPtr(aArr, aArr, N). */
template<size_t N>
RangedPtr(T (&aArr)[N])
explicit RangedPtr(T (&aArr)[N])
: mPtr(aArr)
#ifdef DEBUG
, mRangeStart(aArr), mRangeEnd(aArr + N)
......
......@@ -26,12 +26,12 @@ class ReentrancyGuard
public:
template<class T>
#ifdef DEBUG
ReentrancyGuard(T& aObj
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit ReentrancyGuard(T& aObj
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mEntered(aObj.mEntered)
#else
ReentrancyGuard(T&
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit ReentrancyGuard(T&
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
#endif
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
......
......@@ -238,7 +238,7 @@ public:
MOZ_IMPLICIT RefPtr(T* aVal) : mPtr(ref(aVal)) {}
template<typename U>
RefPtr(const RefPtr<U>& aOther) : mPtr(ref(aOther.get())) {}
MOZ_IMPLICIT RefPtr(const RefPtr<U>& aOther) : mPtr(ref(aOther.get())) {}
~RefPtr() { unref(mPtr); }
......
......@@ -126,11 +126,11 @@ public:
typedef ReverseIterator<IteratorT> const_reverse_iterator;
template<typename Iterator1, typename Iterator2>
IteratorRange(Iterator1 aIterBegin, Iterator2 aIterEnd)
MOZ_IMPLICIT IteratorRange(Iterator1 aIterBegin, Iterator2 aIterEnd)
: mIterBegin(aIterBegin), mIterEnd(aIterEnd) { }
template<typename Iterator>
IteratorRange(const IteratorRange<Iterator>& aOther)
MOZ_IMPLICIT IteratorRange(const IteratorRange<Iterator>& aOther)
: mIterBegin(aOther.mIterBegin), mIterEnd(aOther.mIterEnd) { }
iterator begin() const { return mIterBegin; }
......
......@@ -238,6 +238,7 @@ public:
}
template<typename U, class E>
MOZ_IMPLICIT
UniquePtr(UniquePtr<U, E>&& aOther,
typename EnableIf<IsConvertible<typename UniquePtr<U, E>::Pointer,
Pointer>::value &&
......@@ -478,9 +479,9 @@ public:
MOZ_CONSTEXPR DefaultDelete() {}
template<typename U>
DefaultDelete(const DefaultDelete<U>& aOther,
typename EnableIf<mozilla::IsConvertible<U*, T*>::value,
int>::Type aDummy = 0)
MOZ_IMPLICIT DefaultDelete(const DefaultDelete<U>& aOther,
typename EnableIf<mozilla::IsConvertible<U*, T*>::value,
int>::Type aDummy = 0)
{}
void operator()(T* aPtr) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment