public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110216] New: Outdated implementation of tuple_size requirements for structured binding
@ 2023-06-12 9:09 gnaggnoyil at gmail dot com
2023-06-12 19:24 ` [Bug c++/110216] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: gnaggnoyil at gmail dot com @ 2023-06-12 9:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110216
Bug ID: 110216
Summary: Outdated implementation of tuple_size requirements for
structured binding
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gnaggnoyil at gmail dot com
Target Milestone: ---
The following code is rejected with `g++ -std=c++20` as of GCC 13.1:
#include <tuple>
struct A { int x; };
namespace std
{
template<>
struct tuple_size<::A> {};
}
auto [x] = A{};
Clang 16.0 on the other hand accepts this code with `-std=c++20` flag.
Wording of N4849 (and also the latest working draft as of today) specifies the
expected behavior in [dcl.struct.bind]#4 as follows:
Otherwise, if the qualified-id std::tuple_size<E> names a complete class
type with a member named value, ...
Therefore, the above code shouldn't follow the requirements specified in
[dcl.struct.bind]#4 as tuple-like types. Instead, it should follow those in
[dcl.struct.bind]#5 and do the binding to data members.
This behavior change was introduced by CWG 2386 and corresponding wording
change can be found at
https://github.com/cplusplus/draft/commit/498092ced200140801180dcc9c2878a49350f946
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/110216] Outdated implementation of tuple_size requirements for structured binding
2023-06-12 9:09 [Bug c++/110216] New: Outdated implementation of tuple_size requirements for structured binding gnaggnoyil at gmail dot com
@ 2023-06-12 19:24 ` pinskia at gcc dot gnu.org
2023-06-12 19:25 ` [Bug c++/110216] tuple_size requirements for structured binding has not been updated after DR 2386 pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-12 19:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110216
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Alias| |cwg2386
Ever confirmed|0 |1
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-06-12
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/110216] tuple_size requirements for structured binding has not been updated after DR 2386
2023-06-12 9:09 [Bug c++/110216] New: Outdated implementation of tuple_size requirements for structured binding gnaggnoyil at gmail dot com
2023-06-12 19:24 ` [Bug c++/110216] " pinskia at gcc dot gnu.org
@ 2023-06-12 19:25 ` pinskia at gcc dot gnu.org
2023-06-13 0:10 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-12 19:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110216
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/projects/cxx-dr-status.html
listed as ? there.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/110216] tuple_size requirements for structured binding has not been updated after DR 2386
2023-06-12 9:09 [Bug c++/110216] New: Outdated implementation of tuple_size requirements for structured binding gnaggnoyil at gmail dot com
2023-06-12 19:24 ` [Bug c++/110216] " pinskia at gcc dot gnu.org
2023-06-12 19:25 ` [Bug c++/110216] tuple_size requirements for structured binding has not been updated after DR 2386 pinskia at gcc dot gnu.org
@ 2023-06-13 0:10 ` mpolacek at gcc dot gnu.org
2023-08-14 17:35 ` cvs-commit at gcc dot gnu.org
2024-04-11 18:39 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-06-13 0:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110216
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> https://gcc.gnu.org/projects/cxx-dr-status.html
>
> listed as ? there.
Updated to say "No".
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/110216] tuple_size requirements for structured binding has not been updated after DR 2386
2023-06-12 9:09 [Bug c++/110216] New: Outdated implementation of tuple_size requirements for structured binding gnaggnoyil at gmail dot com
` (2 preceding siblings ...)
2023-06-13 0:10 ` mpolacek at gcc dot gnu.org
@ 2023-08-14 17:35 ` cvs-commit at gcc dot gnu.org
2024-04-11 18:39 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-14 17:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110216
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:1a43af04dd62b80f45700f94ed241347263ed773
commit r14-3204-g1a43af04dd62b80f45700f94ed241347263ed773
Author: gnaggnoyil <gnaggnoyil@gmail.com>
Date: Sat Aug 12 16:16:52 2023 +0800
c++: follow DR 2386 and update implementation of get_tuple_size [PR110216]
DR 2386 updated the tuple_size requirements for structured binding and
it now requires tuple_size to be considered only if
std::tuple_size<TYPE> names a complete class type with member value. GCC
before this patch does not follow the updated requrements, and this
patch is intended to implement it.
(jason) Accepting pseudonym sign-off because a change this small is not
legally significant for copyright.
DR 2386
PR c++/110216
gcc/cp/ChangeLog:
* decl.cc (get_tuple_size): Update implementation for DR 2386.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/decomp10.C: Update expected error for DR 2386.
* g++.dg/cpp1z/pr110216.C: New test.
Signed-off-by: gnaggnoyil <gnaggnoyil@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/110216] tuple_size requirements for structured binding has not been updated after DR 2386
2023-06-12 9:09 [Bug c++/110216] New: Outdated implementation of tuple_size requirements for structured binding gnaggnoyil at gmail dot com
` (3 preceding siblings ...)
2023-08-14 17:35 ` cvs-commit at gcc dot gnu.org
@ 2024-04-11 18:39 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-04-11 18:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110216
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Seems to be fixed; I'm updating cxx-dr-status.html.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-11 18:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 9:09 [Bug c++/110216] New: Outdated implementation of tuple_size requirements for structured binding gnaggnoyil at gmail dot com
2023-06-12 19:24 ` [Bug c++/110216] " pinskia at gcc dot gnu.org
2023-06-12 19:25 ` [Bug c++/110216] tuple_size requirements for structured binding has not been updated after DR 2386 pinskia at gcc dot gnu.org
2023-06-13 0:10 ` mpolacek at gcc dot gnu.org
2023-08-14 17:35 ` cvs-commit at gcc dot gnu.org
2024-04-11 18:39 ` mpolacek 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).