public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115605] New: structured binding break if a variable named tuple_size is visibile at the decomposition site
@ 2024-06-24  5:23 marco.rubini08 at gmail dot com
  2024-06-24  5:54 ` [Bug c++/115605] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: marco.rubini08 at gmail dot com @ 2024-06-24  5:23 UTC (permalink / raw)
  To: gcc-bugs

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
```

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-06-25  5:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24  5:23 [Bug c++/115605] New: structured binding break if a variable named tuple_size is visibile at the decomposition site marco.rubini08 at gmail dot com
2024-06-24  5:54 ` [Bug c++/115605] " pinskia at gcc dot gnu.org
2024-06-24  6:11 ` pinskia at gcc dot gnu.org
2024-06-24 20:50 ` pinskia at gcc dot gnu.org
2024-06-24 21:30 ` pinskia at gcc dot gnu.org
2024-06-24 21:50 ` pinskia at gcc dot gnu.org
2024-06-25  1:20 ` pinskia at gcc dot gnu.org
2024-06-25  5:01 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).