[clang] [Clang][Sema] Mark decomposition decl invalid for explicit array type (PR #210964)

Shengxin Pei via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 03:55:43 PDT 2026


TPPPP72 wrote:

@cor3ntin Maybe we can change it to
```diff
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index e5a5963db27c..7323ebbc66c2 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -861,11 +861,7 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D,
              : diag::err_decomp_decl_type)
         << R;

-    // In most cases, there's no actual problem with an explicitly-specified
-    // type, but a function type won't work here, and ActOnVariableDeclarator
-    // shouldn't be called for such a type.
-    if (R->isFunctionType())
-      D.setInvalidType();
+    D.setInvalidType();
   }

   // Constrained auto is prohibited by [decl.pre]p6, so check that here.
```

This code was submitted nine years ago (likely due to the limitations of the systems at the time); looking at it now, it seems we no longer need such special-case handling.

https://github.com/llvm/llvm-project/pull/210964


More information about the cfe-commits mailing list