Bug 1247338 - really make Atomic's constructor constexpr; r=Waldo

Atomic's constructor is marked as constexpr, but it calls a
non-constexpr function, ToStorageTypeArgument::convert.  For compilers
which require constexpr-ness on constructors to inline away the actual
constructor call, the call to ToStorageTypeArgument::convert completely
disables the constexpr-ness of the constructor.  Let's fix this by
marking all relevant instances of ToStorageTypeArgument::convert as
MOZ_CONSTEXPR, thus satisfying the compiler once again.
This commit is contained in:
Nathan Froyd 2016-02-10 11:28:36 -05:00
parent 2fe8022dbb
commit 57c59afe5a

View File

@ -323,7 +323,7 @@ struct AtomicIntrinsics<T*, Order>
template<typename T>
struct ToStorageTypeArgument
{
static T convert (T aT) { return aT; }
static MOZ_CONSTEXPR T convert (T aT) { return aT; }
};
} // namespace detail
@ -514,13 +514,13 @@ struct ToStorageTypeArgument
{
typedef typename AtomicStorageType<T>::Type ResultType;
static ResultType convert (T aT) { return ResultType(aT); }
static MOZ_CONSTEXPR ResultType convert (T aT) { return ResultType(aT); }
};
template<typename T>
struct ToStorageTypeArgument<T, false>
{
static T convert (T aT) { return aT; }
static MOZ_CONSTEXPR T convert (T aT) { return aT; }
};
} // namespace detail