Skip to content

Commit

Permalink
[clang][Interp] Pointers into unknown-size arrays are never one-past-end
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaederr committed Jun 26, 2024
1 parent b579aac commit dead8f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/lib/AST/Interp/Pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,9 @@ class Pointer {
if (!asBlockPointer().Pointee)
return false;

if (isUnknownSizeArray())
return false;

return isElementPastEnd() ||
(getSize() == getOffset() && !isZeroSizeArray());
}
Expand Down
1 change: 1 addition & 0 deletions clang/test/AST/Interp/arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,3 +626,4 @@ constexpr int *get2() {
extern int same_entity_2[];
return same_entity_2;
}
static_assert(get2() == same_entity_2, "failed to find previous decl");

0 comments on commit dead8f8

Please sign in to comment.