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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:b7e4b5e862fcb12cfeaa3bee4e8c77098201d5f4

commit r16-3122-gb7e4b5e862fcb12cfeaa3bee4e8c77098201d5f4
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Mon Aug 11 09:02:38 2025 +0200

    c++: Fix up handling of name independent structured binding packs
[PR117783]

    I've realized I haven't added testsuite coverage for name independent
    structured binding packs.  And the
      auto [i, ..._, j] = T {};
      auto [k, ..._, l] = T {};
    case shows a problem with that.  The elements of the structured binding
    pack have #i appended to their names, so for the _ case e.g. _#0, _#1
    etc. (to print something useful in diagnostics, perhaps debug info later
    on).  The above is valid though as long as one doesn't use _ (which is
    ambiguous), but we were emitting errors on redeclaration of _#0, _#1
    etc.

    The following patch uses DECL_NAME (decl) = NULL_TREE; for the
    name independent decl case so that the false positive redeclaration
    errors aren't emitted.

    2025-08-11  Jakub Jelinek  <ja...@redhat.com>

            PR c++/117783
            * decl.cc (set_sb_pack_name): For name independent decls
            just clear DECL_NAME instead of appending #i to it.

            * g++.dg/cpp26/name-independent-decl11.C: New test.

Reply via email to