[clang] [Clang] Add diagnostic when scoped enumeration requires an explicit conversion for binary operations (PR #152698)

Timothy Choi via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 15 07:58:17 PDT 2025


================
@@ -13,6 +13,7 @@ enum class E { e };
 
 template<typename T> int f(T t) { return ~t; } // expected-error {{invalid argument type}}
 template<typename T, typename U> int f(T t, U u) { return t % u; } // expected-error {{invalid operands to}}
+                                                                   // expected-note at -1 {{no implicit conversion for scoped enum}}
----------------
tinnamchoi wrote:

The test fails without it
```
error: 'expected-note' diagnostics seen but not expected: 
  File <monorepo-root>/clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3.cpp Line 15: no implicit conversion for scoped enum; consider casting to underlying type
```

https://github.com/llvm/llvm-project/pull/152698


More information about the cfe-commits mailing list