From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 576BA3858C78; Mon, 12 Jun 2023 09:09:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 576BA3858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686560976; bh=wWL7ddSVPWPOKWKxWTPIQt4OM6SXSvO2ojPEO+yuF24=; h=From:To:Subject:Date:From; b=pv7jNp12zyZSUDn6WRUw5rzGKD6iLJennofnhEqtTGCdGl1tyn/H81OmNsGD9K9kT TWMOJ/TAz5UPoWB6uh9HZ+RMcEXJUQ9vtMag4F38gZkk77lw+U63y/HyCti7zYar7M qY0qXlH1qz2M4OeRnjIvC/lp2flrMgjKOtF0HW6I= From: "gnaggnoyil at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110216] New: Outdated implementation of tuple_size requirements for structured binding Date: Mon, 12 Jun 2023 09:09:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gnaggnoyil at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110216 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=3Dc++20` as of GCC 13.1: #include struct A { int x; }; namespace std { template<> struct tuple_size<::A> {}; } auto [x] =3D A{}; Clang 16.0 on the other hand accepts this code with `-std=3Dc++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 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/498092ced200140801180dcc9c2878a49= 350f946=