https://github.com/Lancern updated 
https://github.com/llvm/llvm-project/pull/144226

>From 8046031437a5cfafac17c7c9d978c25fb8ed2479 Mon Sep 17 00:00:00 2001
From: Sirui Mu <msrlanc...@gmail.com>
Date: Sat, 14 Jun 2025 22:25:48 +0800
Subject: [PATCH] [clang][Bytecode] Avoid revisiting decomposition decl

---
 clang/lib/AST/ByteCode/Compiler.cpp |  4 ----
 clang/test/AST/ByteCode/cxx17.cpp   | 10 ++++++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index bf38b2e5d537d..9fe4803ce98ec 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -6591,10 +6591,6 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, 
const Expr *E) {
     return T->isReferenceType();
   };
 
-  // DecompositionDecls are just proxies for us.
-  if (isa<DecompositionDecl>(VD))
-    return revisit(VD);
-
   if ((VD->hasGlobalStorage() || VD->isStaticDataMember()) &&
       typeShouldBeVisited(VD->getType())) {
     if (const Expr *Init = VD->getAnyInitializer();
diff --git a/clang/test/AST/ByteCode/cxx17.cpp 
b/clang/test/AST/ByteCode/cxx17.cpp
index 08a40e0a92862..6898a544a5b2a 100644
--- a/clang/test/AST/ByteCode/cxx17.cpp
+++ b/clang/test/AST/ByteCode/cxx17.cpp
@@ -141,3 +141,13 @@ template <int x> constexpr auto c() {
 }
 
 auto y = c<1>(); // both-note {{in instantiation of function template 
specialization 'c<1>' requested here}}
+
+namespace non_constexpr_structured_binding {
+
+void f1() {
+  int arr[2] = {};
+  auto [a, b] = arr;
+  static_assert(&a != &b);
+}
+
+}

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to