Changeset 262092 in webkit


Ignore:
Timestamp:
May 22, 2020 8:31:22 PM (4 years ago)
Author:
ddkilzer@apple.com
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.

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r262087 r262092  
     12020-05-22  David Kilzer  <ddkilzer@apple.com>
     2
     3        WTF::isValidEnum() has a typo in static_assert making it a tautological comparison
     4        <https://webkit.org/b/212290>
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * wtf/EnumTraits.h:
     9        (WTF::isValidEnum): Use sizeof(std::underlying_type_t<E>)
     10        instead of std::underlying_type_t<E>() to fix the bug.
     11
    1122020-05-22  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/Source/WTF/wtf/EnumTraits.h

    r261254 r262092  
    5757constexpr bool isValidEnum(T t)
    5858{
    59     static_assert(sizeof(T) >= std::underlying_type_t<E>(), "Integral type must be at least the size of the underlying enum type");
     59    static_assert(sizeof(T) >= sizeof(std::underlying_type_t<E>), "Integral type must be at least the size of the underlying enum type");
    6060
    6161    return EnumValueChecker<T, typename EnumTraits<E>::values>::isValidEnum(t);
Note: See TracChangeset for help on using the changeset viewer.