Title
Contradictory specification of std::tuple_size
Status
new
Section
[tuple.helper]
Submitter
Jiang An

Created on 2024-01-20.00:00:00 last changed 9 months ago

Messages

Date: 2024-03-15.00:00:00

[ 2024-03-11; Reflector poll ]

Set priority to 3 after reflector poll. The first part of the issue was fixed editorially.

Date: 2024-01-20.00:00:00

[tuple.helper]/1 currently says:

All specializations of tuple_size meet the Cpp17UnaryTypeTrait requirements ([meta.rqmts]) with a base characteristic of integral_constant<size_t, N> for some N.

which is probably wrong for std::tuple_size<int> and std::tuple_size<std::vector<int>> whose definitions are not provided, and contradicts with [tuple.helper]/4

[…] Otherwise, it has no member value.

Also, there's currently implementation divergence on whether std::tuple_size<cv T> is a complete type when std::tuple_size<T>::value is absent (related to LWG 2770). Some implementations (e.g. libc++ and libstdc++) treat [tuple.helper]/4 and [depr.tuple]/2 as "std::tuple_size<cv T> is generated from partial specializations only if std::tuple_size<T> meets the aforementioned conditions", while others (e.g. MSVC STL) always consider std::tuple_size<cv T> needs to be defined. The latter reading seems to be justified by [contents]/1 and [tuple.syn].

History
Date User Action Args
2024-03-11 22:16:42adminsetmessages: + msg13991
2024-01-20 00:00:00admincreate