aaron.ballman added inline comments.
================ Comment at: clang/lib/AST/Interp/Interp.h:1236-1237 inline bool ShiftRight(InterpState &S, CodePtr OpPC, const T &V, unsigned RHS) { if (RHS >= V.bitWidth()) { S.Stk.push<T>(T::from(0, V.bitWidth())); } else { ---------------- This doesn't seem to match: https://eel.is/c++draft/expr.shift#1.sentence-4 ================ Comment at: clang/lib/AST/Interp/Interp.h:1246-1256 if (V.isSigned() && !S.getLangOpts().CPlusPlus20) { // C++11 [expr.shift]p2: A signed left shift must have a non-negative // operand, and must not overflow the corresponding unsigned type. // C++2a [expr.shift]p2: E1 << E2 is the unique value congruent to // E1 x 2^E2 module 2^N. if (V.isNegative()) { const Expr *E = S.Current->getExpr(OpPC); ---------------- Why do `Shr` and `Shl` check for a negative shift amount to issue a diagnostic but we check for signed in `ShiftLeft` to issue a diagnostic? (I would have expected the checks to all live in the same place.) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136532/new/ https://reviews.llvm.org/D136532 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits