[PATCH] D141192: [Clang] Add warnings on bad shifts inside enums.
Dmitriy Chestnykh via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 7 10:17:45 PST 2023
chestnykh added a comment.
In D141192#4033591 <https://reviews.llvm.org/D141192#4033591>, @shafik wrote:
> So it looks like in `handleIntIntBinOp` we do hit this code:
>
> unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1);
> if (SA != RHS) {
> Info.CCEDiag(E, diag::note_constexpr_large_shift)
> << RHS << E->getType() << LHS.getBitWidth();
>
> So maybe we should figure out why we decide not to emit this diagnostic and fix it there.
In the comment above: "
// C++11 [expr.shift]p1: Shift width must be less than the bit width of
// the shifted type."
Maybe only since C++11 there is the restriction to shift width? Don't you know the standard about it?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141192/new/
https://reviews.llvm.org/D141192
More information about the cfe-commits
mailing list