[PATCH] D131528: [Clang] Restrict non fixed enum to a value outside the range of the enumeration values warning to context requiring a constant expression
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 11 06:44:25 PDT 2022
erichkeane added a comment.
In D131528#3715217 <https://reviews.llvm.org/D131528#3715217>, @mstorsjo wrote:
> There are still some cases that were broken by D131307 <https://reviews.llvm.org/D131307>, that aren't fixed by this patch. Building https://martin.st/temp/qt-enum.cpp with `clang -target i686-w64-mingw32 -c -std=c++17 qt-enum.cpp -Wno-ignored-attributes -Wno-user-defined-literals` succeeded before the change to make those errors downgradable, and those are still an error now.
Diagnostic I'm getting is:
<source>:135567:18: error: integer value -1 is outside the valid range of values [0, 1] for this enumeration type [-Wenum-constexpr-conversion]
if (order == Qt::SortOrder(-1))
SortOrder is:
enum SortOrder {
AscendingOrder,
DescendingOrder
};
So looks like at least the range diagnosed is correct. Latest godbolt shows the issue:
https://godbolt.org/z/vKn57PbGf
BUT I believe this is exactly the case that this patch should have made no longer a problem. Hopefully @shafik can look into this to confirm, and see why this wasn't suppressed.
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