WTF::isValidEnum() has a typo in static_assert making it a tautological comparison
<https://webkit.org/b/212290>

Reviewed by Yusuke Suzuki.

* wtf/EnumTraits.h:
(WTF::isValidEnum): Use sizeof(std::underlying_type_t<E>)
instead of std::underlying_type_t<E>() to fix the bug.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@262092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index a847619..704a453 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -1,3 +1,14 @@
+2020-05-22  David Kilzer  <ddkilzer@apple.com>
+
+        WTF::isValidEnum() has a typo in static_assert making it a tautological comparison
+        <https://webkit.org/b/212290>
+
+        Reviewed by Yusuke Suzuki.
+
+        * wtf/EnumTraits.h:
+        (WTF::isValidEnum): Use sizeof(std::underlying_type_t<E>)
+        instead of std::underlying_type_t<E>() to fix the bug.
+
 2020-05-22  Chris Dumez  <cdumez@apple.com>
 
         RELEASE_ASSERT() that InitializeWebKit2() is getting called on the main thread
diff --git a/Source/WTF/wtf/EnumTraits.h b/Source/WTF/wtf/EnumTraits.h
index 093385f..9927887 100644
--- a/Source/WTF/wtf/EnumTraits.h
+++ b/Source/WTF/wtf/EnumTraits.h
@@ -56,7 +56,7 @@
 template<typename E, typename T, std::enable_if_t<std::is_enum<E>::value && !std::is_same<std::underlying_type_t<E>, bool>::value && !HasCustomIsValidEnum<E>::value>* = nullptr>
 constexpr bool isValidEnum(T t)
 {
-    static_assert(sizeof(T) >= std::underlying_type_t<E>(), "Integral type must be at least the size of the underlying enum type");
+    static_assert(sizeof(T) >= sizeof(std::underlying_type_t<E>), "Integral type must be at least the size of the underlying enum type");
 
     return EnumValueChecker<T, typename EnumTraits<E>::values>::isValidEnum(t);
 }