File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -14764,9 +14764,6 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
14764
14764
// Reject differing bases from the normal codepath; we special-case
14765
14765
// comparisons to null.
14766
14766
if (!HasSameBase(LHSValue, RHSValue)) {
14767
- // Handle &&A - &&B.
14768
- if (!LHSValue.Offset.isZero() || !RHSValue.Offset.isZero())
14769
- return Error(E);
14770
14767
const Expr *LHSExpr = LHSValue.Base.dyn_cast<const Expr *>();
14771
14768
const Expr *RHSExpr = RHSValue.Base.dyn_cast<const Expr *>();
14772
14769
Original file line number Diff line number Diff line change @@ -409,6 +409,10 @@ constexpr int a = 0;
409
409
constexpr int b = 1 ;
410
410
constexpr int n = &b - &a; // expected-error {{must be initialized by a constant expression}} \
411
411
// expected-note {{arithmetic involving unrelated objects '&b' and '&a' has unspecified value}}
412
+ constexpr static int arrk[2 ] = {1 ,2 };
413
+ constexpr static int arrk2[2 ] = {3 ,4 };
414
+ constexpr int k2 = &arrk[1 ] - &arrk2[0 ]; // expected-error {{must be initialized by a constant expression}} \
415
+ // expected-note {{arithmetic involving unrelated objects}}
412
416
413
417
namespace MaterializeTemporary {
414
418
You can’t perform that action at this time.
0 commit comments