[clang][bytecode] Remove unknown-size-array special handling#200789
Merged
Conversation
from `Pointer::toAPValue()`.
|
@llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) Changesfrom 2 Files Affected:
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 93357653c6f5d..96409faeb6929 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -214,10 +214,6 @@ APValue Pointer::toAPValue(const ASTContext &ASTCtx) const {
} else
llvm_unreachable("Invalid allocation type");
- if (isUnknownSizeArray())
- return APValue(Base, CharUnits::Zero(), Path,
- /*IsOnePastEnd=*/isOnePastEnd(), /*IsNullPtr=*/false);
-
CharUnits Offset = CharUnits::Zero();
auto getFieldOffset = [&](const FieldDecl *FD) -> CharUnits {
diff --git a/clang/test/SemaCXX/constant-expression-p2280r4.cpp b/clang/test/SemaCXX/constant-expression-p2280r4.cpp
index 649ed41ca58c4..8b768f42d1260 100644
--- a/clang/test/SemaCXX/constant-expression-p2280r4.cpp
+++ b/clang/test/SemaCXX/constant-expression-p2280r4.cpp
@@ -285,11 +285,9 @@ namespace unsized_array {
void f(int (&a)[], int (&b)[], int (&c)[4]) {
constexpr int t1 = a - a;
constexpr int t2 = a - b; // expected-error {{constexpr variable 't2' must be initialized by a constant expression}} \
- // nointerpreter-note {{arithmetic involving unrelated objects '&a[0]' and '&b[0]' has unspecified value}} \
- // interpreter-note {{arithmetic involving unrelated objects '&a' and '&b' has unspecified value}}
+ // expected-note {{arithmetic involving unrelated objects '&a[0]' and '&b[0]' has unspecified value}}
constexpr int t3 = a - &c[2]; // expected-error {{constexpr variable 't3' must be initialized by a constant expression}} \
- // nointerpreter-note {{arithmetic involving unrelated objects '&a[0]' and '&c[2]' has unspecified value}} \
- // interpreter-note {{arithmetic involving unrelated objects '&a' and '&c[2]' has unspecified value}}
+ // expected-note {{arithmetic involving unrelated objects '&a[0]' and '&c[2]' has unspecified value}}
}
}
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
from
Pointer::toAPValue().