public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114456] New: [C++26] P0609R3 - Attributes for structured bindings
@ 2024-03-25 11:08 jakub at gcc dot gnu.org
2024-03-25 17:21 ` [Bug c++/114456] " jakub at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-25 11:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114456
Bug ID: 114456
Summary: [C++26] P0609R3 - Attributes for 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: ---
See <https://wg21.link/P0609R3>.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114456] [C++26] P0609R3 - Attributes for structured bindings
2024-03-25 11:08 [Bug c++/114456] New: [C++26] P0609R3 - Attributes for structured bindings jakub at gcc dot gnu.org
@ 2024-03-25 17:21 ` jakub at gcc dot gnu.org
2024-03-25 17:53 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-25 17:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114456
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I'll probably take this for stage1.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114456] [C++26] P0609R3 - Attributes for structured bindings
2024-03-25 11:08 [Bug c++/114456] New: [C++26] P0609R3 - Attributes for structured bindings jakub at gcc dot gnu.org
2024-03-25 17:21 ` [Bug c++/114456] " jakub at gcc dot gnu.org
@ 2024-03-25 17:53 ` pinskia at gcc dot gnu.org
2024-04-26 12:41 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-25 17:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114456
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2024-03-25
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114456] [C++26] P0609R3 - Attributes for structured bindings
2024-03-25 11:08 [Bug c++/114456] New: [C++26] P0609R3 - Attributes for structured bindings jakub at gcc dot gnu.org
2024-03-25 17:21 ` [Bug c++/114456] " jakub at gcc dot gnu.org
2024-03-25 17:53 ` pinskia at gcc dot gnu.org
@ 2024-04-26 12:41 ` jakub at gcc dot gnu.org
2024-04-30 6:58 ` cvs-commit at gcc dot gnu.org
2024-04-30 7:08 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-26 12:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114456
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 58045
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58045&action=edit
gcc15-pr114456.patch
Untested implementation.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114456] [C++26] P0609R3 - Attributes for structured bindings
2024-03-25 11:08 [Bug c++/114456] New: [C++26] P0609R3 - Attributes for structured bindings jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2024-04-26 12:41 ` jakub at gcc dot gnu.org
@ 2024-04-30 6:58 ` cvs-commit at gcc dot gnu.org
2024-04-30 7:08 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-30 6:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114456
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:bd35a92f8d44e91c96e8b6f01805fe4a68acf9eb
commit r15-61-gbd35a92f8d44e91c96e8b6f01805fe4a68acf9eb
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Apr 30 08:57:15 2024 +0200
c++: Implement C++26 P0609R3 - Attributes for Structured Bindings
[PR114456]
The following patch implements the P0609R3 paper; we build the
VAR_DECLs for the structured binding identifiers early, so all we need
IMHO is just to parse the attributed identifier list and pass the
attributes
to the VAR_DECL creation.
The paper mentions maybe_unused and gnu::nonstring attributes as examples
where they can be useful. Not sure about either of them.
For maybe_unused, the thing is that both GCC and clang already don't
diagnose maybe unused for the structured binding identifiers, because it
would be a false positive too often; and there is no easy way to find out
if a structured binding has been written with the P0609R3 paper in mind or
not (maybe we could turn it on if in the structured binding is any
attribute, even if just [[]] and record that as a flag on the whole
underlying decl, so that we'd diagnose
auto [a, b, c[[]]] = d;
// use a, c but not b
but not
auto [e, f, g] = d;
// use a, c but not b
). For gnu::nonstring, the issue is that we currently don't allow the
attribute on references to char * or references to char[], just on
char */char[]. I've filed a PR for that.
The first testcase in the patch tests it on [[]] and [[maybe_unused]],
just whether it is parsed properly, second on gnu::deprecated, which
works. Haven't used deprecated attribute because the paper said that
attribute is for further investigation.
2024-04-30 Jakub Jelinek <jakub@redhat.com>
PR c++/114456
gcc/c-family/
* c-cppbuiltin.cc (c_cpp_builtins): Predefine
__cpp_structured_bindings for C++26 to 202403L rather than
201606L.
gcc/cp/
* parser.cc (cp_parser_decomposition_declaration): Implement C++26
P0609R3 - Attributes for Structured Bindings. Parse attributed
identifier lists for structured binding declarations, pass the
attributes to start_decl.
gcc/testsuite/
* g++.dg/cpp26/decomp1.C: New test.
* g++.dg/cpp26/decomp2.C: New test.
* g++.dg/cpp26/feat-cxx26.C (__cpp_structured_bindings): Expect
202403 rather than 201606.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114456] [C++26] P0609R3 - Attributes for structured bindings
2024-03-25 11:08 [Bug c++/114456] New: [C++26] P0609R3 - Attributes for structured bindings jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2024-04-30 6:58 ` cvs-commit at gcc dot gnu.org
@ 2024-04-30 7:08 ` jakub at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-30 7:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114456
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Implemented for GCC 15.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-30 7:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-25 11:08 [Bug c++/114456] New: [C++26] P0609R3 - Attributes for structured bindings jakub at gcc dot gnu.org
2024-03-25 17:21 ` [Bug c++/114456] " jakub at gcc dot gnu.org
2024-03-25 17:53 ` pinskia at gcc dot gnu.org
2024-04-26 12:41 ` jakub at gcc dot gnu.org
2024-04-30 6:58 ` cvs-commit at gcc dot gnu.org
2024-04-30 7:08 ` jakub 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).