[PATCH] D127518: [Diagnostics] Fix inconsistent shift-overflow warnings in C++20

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 07:34:20 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:11425-11426
   // then, the behavior is undefined before C++2a. Warn about it.
   if (Left.isNegative() && !S.getLangOpts().isSignedOverflowDefined() &&
       !S.getLangOpts().CPlusPlus20) {
     S.DiagRuntimeBehavior(Loc, LHS.get(),
----------------
aaron.ballman wrote:
> and then we can remove the check for signed overflow defined or C++20 here because we've already bailed out.
I think we'd want to remove the CPlusPlus20 check here, right? Signed-overflow should cover this case as well, and the check for C++20 below is no longer necessary?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127518/new/

https://reviews.llvm.org/D127518



More information about the cfe-commits mailing list