https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115605

            Bug ID: 115605
           Summary: structured binding break if a variable named
                    tuple_size is visibile at the decomposition site
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marco.rubini08 at gmail dot com
  Target Milestone: ---

Example:


```
// a.cpp
#include <array>

int foo() {
    int const tuple_size = 5;
    std::array<int, 3> array {1, 2, 3};
    auto [a, b, c] = array;
    return c;
}

```

g++ std=c++20 a.cpp

```
a.cpp: In function ‘int foo()’:
a.cpp:6:10: error: 3 names provided for structured binding
    6 |     auto [a, b, c] = array;
      |          ^~~~~~~~~
a.cpp:6:10: note: while ‘std::array<int, 3>’ decomposes into 1 element
```

Reply via email to