shafik added a comment.
In D131528#3717141 <https://reviews.llvm.org/D131528#3717141>, @gulfem wrote:
> Can somebody please clarify this? Is the following code results in
> `undefined` behavior?
>
> enum E1 {e11=-4, e12=4};
> E1 x2b = static_cast<E1>(8);
>
> `constexpr E1 x2 = static_cast<E1>(8)` seems like `undefined`, so
> `-Wenum-constexpr-conversion` is triggered.
> We started seeing `-Wenum-constexpr-conversion` in our codebase after
> https://reviews.llvm.org/D131307, but we stopped seeing them after this
> review.
> Is the first example that I show above still undefined, but
> `-Wenum-constexpr-conversion` is not going to warn in such cases?
Yes, this is indeed undefined behavior. The initial patch effected a lot of
users and several third party packages and so I am trying to narrow the impact
by restricting the error to those cases that are constant expression contexts
only.
So you may indeed less diagnostics now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131528/new/
https://reviews.llvm.org/D131528
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits