Skip to content

Commit c07f4ee

Browse files
authored
[clang][bytecode] Remove unknown-size-array special handling (#200789)
from `Pointer::toAPValue()`.
1 parent b05c5e4 commit c07f4ee

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

clang/lib/AST/ByteCode/Pointer.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,6 @@ APValue Pointer::toAPValue(const ASTContext &ASTCtx) const {
214214
} else
215215
llvm_unreachable("Invalid allocation type");
216216

217-
if (isUnknownSizeArray())
218-
return APValue(Base, CharUnits::Zero(), Path,
219-
/*IsOnePastEnd=*/isOnePastEnd(), /*IsNullPtr=*/false);
220-
221217
CharUnits Offset = CharUnits::Zero();
222218

223219
auto getFieldOffset = [&](const FieldDecl *FD) -> CharUnits {

clang/test/SemaCXX/constant-expression-p2280r4.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,9 @@ namespace unsized_array {
285285
void f(int (&a)[], int (&b)[], int (&c)[4]) {
286286
constexpr int t1 = a - a;
287287
constexpr int t2 = a - b; // expected-error {{constexpr variable 't2' must be initialized by a constant expression}} \
288-
// nointerpreter-note {{arithmetic involving unrelated objects '&a[0]' and '&b[0]' has unspecified value}} \
289-
// interpreter-note {{arithmetic involving unrelated objects '&a' and '&b' has unspecified value}}
288+
// expected-note {{arithmetic involving unrelated objects '&a[0]' and '&b[0]' has unspecified value}}
290289
constexpr int t3 = a - &c[2]; // expected-error {{constexpr variable 't3' must be initialized by a constant expression}} \
291-
// nointerpreter-note {{arithmetic involving unrelated objects '&a[0]' and '&c[2]' has unspecified value}} \
292-
// interpreter-note {{arithmetic involving unrelated objects '&a' and '&c[2]' has unspecified value}}
290+
// expected-note {{arithmetic involving unrelated objects '&a[0]' and '&c[2]' has unspecified value}}
293291
}
294292
}
295293

0 commit comments

Comments
 (0)