[PATCH] D131528: [Clang] Restrict non fixed enum to a value outside the range of the enumeration values warning to context requiring a constant expression
Gulfem Savrun Yeniceri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 11 12:34:23 PDT 2022
gulfem added a comment.
Can somebody please clarify this? Is the following code results `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?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131528/new/
https://reviews.llvm.org/D131528
More information about the cfe-commits
mailing list