Title: [262092] trunk/Source/WTF
Revision
262092
Author
[email protected]
Date
2020-05-22 20:31:22 -0700 (Fri, 22 May 2020)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (262091 => 262092)


--- trunk/Source/WTF/ChangeLog	2020-05-23 02:26:29 UTC (rev 262091)
+++ trunk/Source/WTF/ChangeLog	2020-05-23 03:31:22 UTC (rev 262092)
@@ -1,3 +1,14 @@
+2020-05-22  David Kilzer  <[email protected]>
+
+        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  <[email protected]>
 
         RELEASE_ASSERT() that InitializeWebKit2() is getting called on the main thread

Modified: trunk/Source/WTF/wtf/EnumTraits.h (262091 => 262092)


--- trunk/Source/WTF/wtf/EnumTraits.h	2020-05-23 02:26:29 UTC (rev 262091)
+++ trunk/Source/WTF/wtf/EnumTraits.h	2020-05-23 03:31:22 UTC (rev 262092)
@@ -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);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to