Bug 987290 - Follow-up: fix TestTypedEnum to avoid requiring behavior that relies on explicit conversions, when they are not available. Fixes the build on MSVC 2012 - no review, bustage fix
authorBenoit Jacob <bjacob@mozilla.com>
Sun, 27 Apr 2014 22:46:40 -0400
changeset 180910 ba55dd0b1a12bcc3462d7b4357e20ea1dbf2f007
parent 180909 2b71adff7fe47c450de4b87d2bf4a08db841338e
child 180911 3a49b88c5bb05b15aabcde775e18aa405c0bf7a1
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
bugs987290
milestone31.0a1
Bug 987290 - Follow-up: fix TestTypedEnum to avoid requiring behavior that relies on explicit conversions, when they are not available. Fixes the build on MSVC 2012 - no review, bustage fix
mfbt/tests/TestTypedEnum.cpp
--- a/mfbt/tests/TestTypedEnum.cpp
+++ b/mfbt/tests/TestTypedEnum.cpp
@@ -1,13 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Assertions.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/TypedEnum.h"
 #include "mozilla/TypedEnumBits.h"
 
 #include <stdint.h>
 
 // A rough feature check for is_literal_type. Not very carefully checked.
 // Feel free to amend as needed.
 // We leave ANDROID out because it's using stlport which doesn't have std::is_literal_type.
@@ -153,17 +154,18 @@ MAKE_STANDARD_BITFIELD_FOR_TYPE(unsigned
 
 #undef MAKE_STANDARD_BITFIELD_FOR_TYPE
 
 template<typename T>
 void
 TestNonConvertibilityForOneType()
 {
   using mozilla::IsConvertible;
-#ifdef MOZ_HAVE_CXX11_STRONG_ENUMS
+
+#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS) && defined(MOZ_HAVE_EXPLICIT_CONVERSION)
   static_assert(!IsConvertible<T, bool>::value, "should not be convertible");
   static_assert(!IsConvertible<T, int>::value, "should not be convertible");
   static_assert(!IsConvertible<T, uint64_t>::value, "should not be convertible");
 #endif
 
   static_assert(!IsConvertible<bool, T>::value, "should not be convertible");
   static_assert(!IsConvertible<int, T>::value, "should not be convertible");
   static_assert(!IsConvertible<uint64_t, T>::value, "should not be convertible");