This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2023-01-15


2386. tuple_size requirements for structured binding

Section: 9.6  [dcl.struct.bind]     Status: CD5     Submitter: Stephan T. Lavavej     Date: 2018-09-19

[Accepted as a DR at the February, 2019 meeting.]

According to 9.6 [dcl.struct.bind] paragraph 4,

Otherwise, if the qualified-id std::tuple_size<E> names a complete type, the expression std::tuple_size<E>::value shall be a well-formed integral constant expression and the number of elements in the identifier-list shall be equal to the value of that expression.

However, the common idiom in the library is that SFINAE tests the presence or absence of a value member rather than the completeness of the class; see 22.4.7 [tuple.helper] paragraph 4. The core language requirement should be changed to match the common library practice.

Proposed resolution (December, 2018):

Change 9.5 [dcl.fct.def] paragraph 4 as follows:

Otherwise, if the qualified-id std::tuple_size<E> names a complete class type with a member value, the expression std::tuple_size<E>::value shall be a well-formed integral constant expression and the number of elements in the identifier-list shall be equal to the value of that expression...