File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -2117,8 +2117,8 @@ bool DiagTypeid(InterpState &S, CodePtr OpPC) {
2117
2117
2118
2118
bool arePotentiallyOverlappingStringLiterals (const Pointer &LHS,
2119
2119
const Pointer &RHS) {
2120
- unsigned LHSOffset = LHS.getIndex ();
2121
- unsigned RHSOffset = RHS.getIndex ();
2120
+ unsigned LHSOffset = LHS.isOnePastEnd () ? LHS. getNumElems () : LHS. getIndex ();
2121
+ unsigned RHSOffset = RHS.isOnePastEnd () ? RHS. getNumElems () : RHS. getIndex ();
2122
2122
unsigned LHSLength = (LHS.getNumElems () - 1 ) * LHS.elemSize ();
2123
2123
unsigned RHSLength = (RHS.getNumElems () - 1 ) * RHS.elemSize ();
2124
2124
Original file line number Diff line number Diff line change @@ -287,6 +287,8 @@ namespace OverlappingStrings {
287
287
constexpr bool may_overlap_4 = &" xfoo" [1 ] == &" xfoo" [1 ]; // both-error {{}} both-note {{addresses of potentially overlapping literals}}
288
288
289
289
290
+ // / Used to crash.
291
+ const bool x = &" ab" [0 ] == &" ba" [3 ];
290
292
291
293
}
292
294
You can’t perform that action at this time.
0 commit comments