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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 1 04:49:48 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/test/AST/Interp/literals.cpp:553
+  static_assert(IntRem(2, 1) == 0, "");
+  static_assert(IntRem(9, 7) == 2, "");
+
----------------
```
static_assert(IntRem(9, 0) == 12, ""); // Not constexpr
static_assert(IntRem(__INT_MIN__, -1) == 12, ""); // Not constexpr
```


================
Comment at: clang/test/AST/Interp/literals.cpp:572-573
+  static_assert(IntDiv(12, 20) == 0, "");
+  static_assert(IntDiv(2, 1) == 2, "");
+  static_assert(IntDiv(9, 7) == 1, "");
+
----------------
Same suggestion for div as for rem


================
Comment at: clang/test/AST/Interp/literals.cpp:595
+  static_assert(IntMul(2, 1) == 2, "");
+  static_assert(IntMul(9, 7) == 63, "");
 };
----------------
An overflow test would be good here.


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

https://reviews.llvm.org/D137071



More information about the cfe-commits mailing list