[Bug c++/115586] c++26: with 2 or more name-independent declarations (anonymous/placeholder structure bindings) with for loop

2025-02-13 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115586

Jakub Jelinek  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Target Milestone|--- |14.3
 Status|ASSIGNED|RESOLVED

--- Comment #11 from Jakub Jelinek  ---
Fixed for 14.3 too.

[Bug c++/115586] c++26: with 2 or more name-independent declarations (anonymous/placeholder structure bindings) with for loop

2025-02-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115586

--- Comment #10 from GCC Commits  ---
The releases/gcc-14 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:08bfa32ae92e36a791ebdefd063b4f2616cd6f80

commit r14-11297-g08bfa32ae92e36a791ebdefd063b4f2616cd6f80
Author: Jakub Jelinek 
Date:   Fri Feb 7 17:08:39 2025 +0100

c++: Fix up name independent decl in structured binding handling in range
for [PR115586]

cp_parser_range_for temporarily reverts IDENTIFIER_BINDING changes
to hide the decls from the structured bindings from lookup during
parsing of the expression after :
If there are 2 or more name independent decls, we undo IDENTIFIER_BINDING
for the same name multiple times, even when just one has been added
(with a TREE_LIST inside of it as decl).

The following patch fixes it by handling the _ name at most once, the
later loop will DTRT then and just reinstall the temporarily hidden
binding with the TREE_LIST in there.

2025-02-07  Jakub Jelinek  

PR c++/115586
* parser.cc (cp_parser_range_for): For name independent decls in
structured bindings, only push the name/binding once per
structured binding.

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

(cherry picked from commit ca7c6d1212b8589deed18386427c67851af2b9ad)

[Bug c++/115586] c++26: with 2 or more name-independent declarations (anonymous/placeholder structure bindings) with for loop

2025-02-07 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115586

--- Comment #9 from Jakub Jelinek  ---
Fixed for 15+ so far.

[Bug c++/115586] c++26: with 2 or more name-independent declarations (anonymous/placeholder structure bindings) with for loop

2025-02-07 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115586

--- Comment #8 from GCC Commits  ---
The master branch has been updated by Jakub Jelinek :

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

commit r15-7427-gca7c6d1212b8589deed18386427c67851af2b9ad
Author: Jakub Jelinek 
Date:   Fri Feb 7 17:08:39 2025 +0100

c++: Fix up name independent decl in structured binding handling in range
for [PR115586]

cp_parser_range_for temporarily reverts IDENTIFIER_BINDING changes
to hide the decls from the structured bindings from lookup during
parsing of the expression after :
If there are 2 or more name independent decls, we undo IDENTIFIER_BINDING
for the same name multiple times, even when just one has been added
(with a TREE_LIST inside of it as decl).

The following patch fixes it by handling the _ name at most once, the
later loop will DTRT then and just reinstall the temporarily hidden
binding with the TREE_LIST in there.

2025-02-07  Jakub Jelinek  

PR c++/115586
* parser.cc (cp_parser_range_for): For name independent decls in
structured bindings, only push the name/binding once per
structured binding.

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

[Bug c++/115586] c++26: with 2 or more name-independent declarations (anonymous/placeholder structure bindings) with for loop

2025-02-06 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115586

--- Comment #7 from Jakub Jelinek  ---
Created attachment 60393
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60393&action=edit
gcc15-pr115586.patch

Untested fix.