From 6a5930b4544acd0d4ae8145e2bef0b765fc44601 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 10 Feb 2016 11:28:36 -0500 Subject: [PATCH] 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. --- mfbt/Atomics.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mfbt/Atomics.h b/mfbt/Atomics.h index 6293344dc8da..291279ed47ee 100644 --- a/mfbt/Atomics.h +++ b/mfbt/Atomics.h @@ -323,7 +323,7 @@ struct AtomicIntrinsics template 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::Type ResultType; - static ResultType convert (T aT) { return ResultType(aT); } + static MOZ_CONSTEXPR ResultType convert (T aT) { return ResultType(aT); } }; template struct ToStorageTypeArgument { - static T convert (T aT) { return aT; } + static MOZ_CONSTEXPR T convert (T aT) { return aT; } }; } // namespace detail