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