aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-04-17 17:27:19 +0200
committerGitHub <noreply@github.com>2025-04-17 17:27:19 +0200
commitecbd2d5e148cc1f2e5795d13d752e2a1c79cce1a (patch)
tree89883450e09fffa60555eda19802eb067e3003d1 /clang/lib/AST/ExprConstant.cpp
parent909a9feda9292be8a7322f07dd167a603309b541 (diff)
downloadllvm-ecbd2d5e148cc1f2e5795d13d752e2a1c79cce1a.zip
llvm-ecbd2d5e148cc1f2e5795d13d752e2a1c79cce1a.tar.gz
llvm-ecbd2d5e148cc1f2e5795d13d752e2a1c79cce1a.tar.bz2
[clang][ExprConst] Diagnose ptr subs with non-zero offset (#135938)
The attached test case was missing the note.
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index d1cc722..b14ff21 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -14764,9 +14764,6 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
// Reject differing bases from the normal codepath; we special-case
// comparisons to null.
if (!HasSameBase(LHSValue, RHSValue)) {
- // Handle &&A - &&B.
- if (!LHSValue.Offset.isZero() || !RHSValue.Offset.isZero())
- return Error(E);
const Expr *LHSExpr = LHSValue.Base.dyn_cast<const Expr *>();
const Expr *RHSExpr = RHSValue.Base.dyn_cast<const Expr *>();