aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from some style nits. Can you also add a release note for the fix?



================
Comment at: clang/lib/AST/ExprConstant.cpp:2759-2760
                               APSInt &Result) {
+  bool HandleOverflowResult = true;
   switch (Opcode) {
   default:
----------------



================
Comment at: clang/lib/AST/ExprConstant.cpp:2777-2789
   case BO_Rem:
     if (RHS == 0) {
       Info.FFDiag(E, diag::note_expr_divide_by_zero);
       return false;
     }
-    Result = (Opcode == BO_Rem ? LHS % RHS : LHS / RHS);
     // Check for overflow case: INT_MIN / -1 or INT_MIN % -1. APSInt supports
     // this operation and gives the two's complement result.
----------------



================
Comment at: clang/test/CXX/expr/expr.const/p2-0x.cpp:304
+namespace CompoundAssignment {
+int constexpr rem() { // expected-error {{constexpr function never produces a 
constant expression}}
+    int x = ~__INT_MAX__;
----------------



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

https://reviews.llvm.org/D140455

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to