https://github.com/Tsche updated 
https://github.com/llvm/llvm-project/pull/195860

>From be798f3fa8a33149b5e9815d98717651f93d300b Mon Sep 17 00:00:00 2001
From: Matthias Wippich <[email protected]>
Date: Mon, 4 May 2026 05:30:53 +0200
Subject: [PATCH] [clang] propagate constexpr to binding VarDecl

---
 clang/lib/Sema/SemaDeclCXX.cpp             | 1 +
 clang/test/SemaCXX/cxx2c-decomposition.cpp | 4 ----
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index de837ff0608d0..39c3aa2cdc2c0 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -1405,6 +1405,7 @@ static bool checkTupleLikeDecomposition(Sema &S,
                         /*TInfo=*/nullptr, Src->getStorageClass());
     BindingVD->setLexicalDeclContext(Src->getLexicalDeclContext());
     BindingVD->setTSCSpec(Src->getTSCSpec());
+    BindingVD->setConstexpr(Src->isConstexpr());
     BindingVD->setImplicit();
     if (Src->isInlineSpecified())
       BindingVD->setInlineSpecified();
diff --git a/clang/test/SemaCXX/cxx2c-decomposition.cpp 
b/clang/test/SemaCXX/cxx2c-decomposition.cpp
index df2e3fa90263a..3e7fdfc904958 100644
--- a/clang/test/SemaCXX/cxx2c-decomposition.cpp
+++ b/clang/test/SemaCXX/cxx2c-decomposition.cpp
@@ -62,12 +62,8 @@ void test() {
     test_tpl(0);
 }
 
-// FIXME : support tuple
 constexpr auto [a, b] = B{};
 static_assert(a.n == 0);
-// expected-error@-1 {{static assertion expression is not an integral constant 
expression}} \
-// expected-note@-1 {{read of non-constexpr variable 'a' is not allowed in a 
constant expression}} \
-// expected-note@-2 {{declared here}}
 
 constinit auto [init1] = Y {42};
 constinit auto [init2] = X {};  // expected-error {{variable does not have a 
constant initializer}} \

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

Reply via email to