[PATCH] D137071: [clang][Interp] Implement missing compound assign operators

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 20 22:11:00 PST 2022


shafik accepted this revision.
shafik added a comment.

LGTM



================
Comment at: clang/test/AST/Interp/literals.cpp:553
+  static_assert(IntRem(2, 1) == 0, "");
+  static_assert(IntRem(9, 7) == 2, "");
+
----------------
aaron.ballman wrote:
> tbaeder wrote:
> > aaron.ballman wrote:
> > > aaron.ballman wrote:
> > > > ```
> > > > static_assert(IntRem(9, 0) == 12, ""); // Not constexpr
> > > > static_assert(IntRem(__INT_MIN__, -1) == 12, ""); // Not constexpr
> > > > ```
> > > Missed the test for __INT_MIN__ and -1?
> > for rem, clang doesn't diagnose anything: https://godbolt.org/z/rhe5ezc54
> That's a bug per https://eel.is/c++draft/expr.mul#4.sentence-3 because the resulting algebraic value is not representable in the type of the result.
Ok, this bugged me enough I figured out what was going on and put up a PR: https://reviews.llvm.org/D140455


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

https://reviews.llvm.org/D137071



More information about the cfe-commits mailing list