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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to