@@ -1429,16 +1429,19 @@ operator<<(const StreamingDiagnostic &DB, T *DC) {
14291429 return DB;
14301430}
14311431
1432- // Convert scope enums to their underlying type, so that we don't have
1432+ // Convert scoped enums to their underlying type, so that we don't have
14331433// clutter the emitting code with `llvm::to_underlying()`.
14341434// We also need to disable implicit conversion for the first argument,
14351435// because classes that derive from StreamingDiagnostic define their own
14361436// templated operator<< that accept a wide variety of types, leading
14371437// to ambiguity.
1438- template <typename T, typename U>
1438+ template <typename T, typename U,
1439+ typename UnderlyingU = typename std::enable_if_t <
1440+ std::is_enum_v<std::remove_reference_t <U>>,
1441+ std::underlying_type<std::remove_reference_t <U>>>::type>
14391442inline std::enable_if_t <
14401443 std::is_same_v<std::remove_const_t <T>, StreamingDiagnostic> &&
1441- llvm::is_scoped_enum_v< std::remove_reference_t <U> >,
1444+ ! std::is_convertible_v<U, UnderlyingU >,
14421445 const StreamingDiagnostic &>
14431446operator <<(const T &DB, U &&SE) {
14441447 DB << llvm::to_underlying (SE);
0 commit comments