public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111069] New: Mangling of static structured bindings
@ 2023-08-18 18:47 jakub at gcc dot gnu.org
  2023-08-18 18:50 ` [Bug c++/111069] " jakub at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-08-18 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111069
           Summary: Mangling of static structured bindings
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

void
corge ()
{
  static int a[2];
  static auto [i, j] = a;
  static auto [k, l] = a;
  {
    static auto [i, j] = a;
    static auto [k, l] = a;
  }
  {
    static auto [i, j] = a;
    static auto [k, l] = a;
  }
}

fails to assemble with -std=c++20, we use
_ZNDC1i1jEE and _ZNDC1k1lEE as names of the local variables multiple times
(+ _ZGVZ5corgevE11_ZNDC1i1jEE and _ZGVZ5corgevE11_ZNDC1k1lEE for guards which
are emitted each just once but prevent the initialization of the second and
third case).
clang++ uses _ZZ5corgevEDC1i1jE, _ZZ5corgevEDC1k1lE_0, _ZZ5corgevEDC1i1jE_1,
_ZZ5corgevEDC1k1lE_2 etc. and corresponding guard vars.
Now, I guess for local vars it is up to us to name those as we want as long as
there is no clash, with
inline void
freddy ()
{
  static int a[2];
  static auto [i, j] = a;
  static auto [k, l] = a;
  {
    static auto [i, j] = a;
    static auto [k, l] = a;
  }
  {
    static auto [i, j] = a;
    static auto [k, l] = a;
  }
}
void (*p)() = &freddy;
it is an ABI issue.

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

end of thread, other threads:[~2023-09-01 13:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-18 18:47 [Bug c++/111069] New: Mangling of static structured bindings jakub at gcc dot gnu.org
2023-08-18 18:50 ` [Bug c++/111069] " jakub at gcc dot gnu.org
2023-08-18 18:51 ` pinskia at gcc dot gnu.org
2023-08-18 19:02 ` jakub at gcc dot gnu.org
2023-08-18 19:08 ` jakub at gcc dot gnu.org
2023-08-19 10:12 ` jakub at gcc dot gnu.org
2023-08-21  9:20 ` jakub at gcc dot gnu.org
2023-09-01 13:15 ` cvs-commit 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).