Title
Missing restrictions on which types can be `tuple` elements
Status
new
Section
[tuple.tuple.general]
Submitter
Davis Herring

Created on 2025-11-21.00:00:00 last changed 6 days ago

Messages

Date: 2026-01-15.00:00:00

[ 2026-01-16; Reflector poll. ]

Set priority to 3 after reflector poll.

Date: 2025-11-15.00:00:00

[ 2025-11-26; Jonathan comments. ]

[res.on.functions] already makes it undefined behaviour to instantiate `tuple` with an incomplete type, which includes `void` and `int[]`. It would be better if it was ill-formed not undefined though, and that doesn't say anything about tuple<int()> or tuple<AbstractClassType>. Any restrictions should only apply when `tuple` is instantiated, not just when it's declared, as that would prevent using it as a typelist.

We might need to specify that `tuple_size` and `tuple_element` can be instantiated with incomplete types that are specializations of `tuple`, because otherwise [res.on.functions] makes that undefined. `tuple_size` and `tuple_element` don't need a complete `tuple` type to give an answer, and they don't need to instantiate a `tuple` type. So tuple_element_t<0, tuple<void>> should work.

Date: 2025-11-26.19:05:56

We do not say that instantiating types like std::tuple<void> or std::tuple<int()> won't work.

History
Date User Action Args
2026-01-16 15:25:05adminsetmessages: + msg15858
2025-11-26 19:05:56adminsetmessages: + msg15763
2025-11-21 00:00:00admincreate