[PATCH] D142867: [Clang] Add machinery to catch overflow in unary minus outside of a constant expression context
Evgeny Eltsin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 6 13:52:09 PST 2023
eaeltsin added a comment.
The warning now fires even if it is prevent with `if constexpr`:
if constexpr (width <= 64) {
if constexpr (width == 64) {
return 1;
}
return -static_cast<int64_t>(uint64_t{1} << (width - 1));
}
https://godbolt.org/z/M3xdcKd3M
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142867/new/
https://reviews.llvm.org/D142867
More information about the cfe-commits
mailing list