[PATCH] D122808: [clang] Fix warnings when `-Wdeprecated-enum-enum-conversion` is enabled
Antonio Frighetto via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 4 01:35:33 PDT 2022
antoniofrighetto added a comment.
Looks definitely better! How about this slightly changed version protecting the interface?
/// Helper which adds two underlying types of enumeration type.
template <typename EnumTy1,
typename EnumTy2,
typename UT1 = std::enable_if_t<std::is_enum_v<EnumTy1>, std::underlying_type_t<EnumTy1>>,
typename UT2 = std::enable_if_t<std::is_enum_v<EnumTy2>, std::underlying_type_t<EnumTy2>>>
constexpr auto addEnumValues(EnumTy1 LHS, EnumTy2 RHS) {
return static_cast<UT1>(LHS) + static_cast<UT2>(RHS);
}
I feel like this is something we may wish to readopt in the future for other similar cases as well (e.g., `-Wdeprecated-anon-enum-enum-conversion` in `Comment.h`).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122808/new/
https://reviews.llvm.org/D122808
More information about the cfe-commits
mailing list