[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 23 21:05:50 PST 2025


================
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -std=c++2c -verify -fsyntax-only %s
+
+template <unsigned N>
+void decompose_array() {
+  int arr[4] = {1, 2, 3, 5};
+  auto [x, ... // #1
+    rest, ...more_rest] = arr; // expected-error{{multiple packs in structured binding declaration}}
+                               // expected-note@#1{{previous binding pack specified here}}
+                               //
+  auto [y...] = arr; // expected-error{{'...' must immediately precede declared identifier}}
----------------
shafik wrote:

Maybe some tests w/ just `...` like

```cpp
auto [...] = arr; // error
auto [a,...,b] = arr; // error
```

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


More information about the cfe-commits mailing list