https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/200789

from `Pointer::toAPValue()`.

>From a00ef17fe29c123fd0c1e500ea87bdd5db6f4c73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
Date: Mon, 1 Jun 2026 13:40:37 +0200
Subject: [PATCH] [clang][bytecode] Remove unknown-size-array special handling

from `Pointer::toAPValue()`.
---
 clang/lib/AST/ByteCode/Pointer.cpp                 | 4 ----
 clang/test/SemaCXX/constant-expression-p2280r4.cpp | 6 ++----
 2 files changed, 2 insertions(+), 8 deletions(-)

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}}
   }
 }
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to