[Webkit-unassigned] [Bug 212290] New: WTF::isValidEnum() has a typo in static_assert making it a tautological comparison

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 22 16:50:53 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=212290

            Bug ID: 212290
           Summary: WTF::isValidEnum() has a typo in static_assert making
                    it a tautological comparison
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ddkilzer at webkit.org
                CC: darin at apple.com

WTF::isValidEnum() has a typo in static_assert making it a tautological comparison.

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");

    return EnumValueChecker<T, typename EnumTraits<E>::values>::isValidEnum(t);
}

Note that `sizeof(T) >= std::underlying_type_t<E>()` is a tautological comparison because `std::underlying_type_t<E>()` evaluates to zero.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200522/2d4e0575/attachment.htm>


More information about the webkit-unassigned mailing list