Bug 212290 - REGRESSION (r204916): WTF::isValidEnum() has a typo in static_assert making it a tautological comparison
Summary: REGRESSION (r204916): WTF::isValidEnum() has a typo in static_assert making i...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on: 161103
Blocks:
  Show dependency treegraph
 
Reported: 2020-05-22 16:50 PDT by David Kilzer (:ddkilzer)
Modified: 2020-05-22 20:32 PDT (History)
8 users (show)

See Also:


Attachments
Patch v1 (1.61 KB, patch)
2020-05-22 16:54 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2020-05-22 16:50:53 PDT
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.
Comment 1 David Kilzer (:ddkilzer) 2020-05-22 16:54:00 PDT
Created attachment 400089 [details]
Patch v1
Comment 2 David Kilzer (:ddkilzer) 2020-05-22 16:56:09 PDT
Regressed in r204916:  <https://trac.webkit.org/r204916>
Comment 3 Yusuke Suzuki 2020-05-22 17:44:04 PDT
Comment on attachment 400089 [details]
Patch v1

r=me
Comment 4 EWS 2020-05-22 20:31:28 PDT
Committed r262092: <https://trac.webkit.org/changeset/262092>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 400089 [details].
Comment 5 Radar WebKit Bug Importer 2020-05-22 20:32:15 PDT
<rdar://problem/63562556>