shafik added a comment.

In D131704#3717774 <https://reviews.llvm.org/D131704#3717774>, @akhuang wrote:

> We're seeing this warning in code with global constants, e.g.
>
>   const Enum x = static_cast<Enum>(-1);
>
> is this intended?

This is constant initialization, so this is indeed expected.

Depending on your situation you can fix this by using a fixed underlying type 
e.g. : `enum A : int` or by making it a scoped enum `enum class A` or by 
extending the enumerators themselves to include the value you are using.

If this not your code you can also turn the error into a warning using 
`-Wno-error=enum-constexpr-conversion`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131704/new/

https://reviews.llvm.org/D131704

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

Reply via email to