@@ -1429,16 +1429,19 @@ operator<<(const StreamingDiagnostic &DB, T *DC) {
1429
1429
return DB;
1430
1430
}
1431
1431
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
1433
1433
// clutter the emitting code with `llvm::to_underlying()`.
1434
1434
// We also need to disable implicit conversion for the first argument,
1435
1435
// because classes that derive from StreamingDiagnostic define their own
1436
1436
// templated operator<< that accept a wide variety of types, leading
1437
1437
// 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>
1439
1442
inline std::enable_if_t <
1440
1443
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 >,
1442
1445
const StreamingDiagnostic &>
1443
1446
operator <<(const T &DB, U &&SE) {
1444
1447
DB << llvm::to_underlying (SE);
0 commit comments