File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed
Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -859,6 +859,8 @@ Bug Fixes to C++ Support
859859 (#GH88081), (#GH89496), (#GH90669) and (#GH91633).
860860- Fixed handling of brace ellison when building deduction guides. (#GH64625), (#GH83368).
861861- Clang now instantiates local constexpr functions eagerly for constant evaluators. (#GH35052), (#GH94849)
862+ - Fixed a failed assertion when attempting to convert an integer representing the difference
863+ between the addresses of two labels (a GNU extension) to a pointer within a constant expression. (#GH95366).
862864
863865Bug Fixes to AST Handling
864866^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -9325,6 +9325,13 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
93259325 Result.IsNullPtr = false;
93269326 return true;
93279327 } else {
9328+ // In rare instances, the value isn't an lvalue.
9329+ // For example, when the value is the difference between the addresses of
9330+ // two labels. We reject that as a constant expression because we can't
9331+ // compute a valid offset to convert into a pointer.
9332+ if (!Value.isLValue())
9333+ return false;
9334+
93289335 // Cast is of an lvalue, no need to change value.
93299336 Result.setFrom(Info.Ctx, Value);
93309337 return true;
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 %s -verify -fsyntax-only -std=c11
2+
3+ int x (void ) { e : b : ; return & & e - & & b < x ; } // expected-warning {{ordered comparison between pointer and integer}}
You can’t perform that action at this time.
0 commit comments