This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
tuple elementsSection: 22.4.4.1 [tuple.tuple.general] Status: New Submitter: Davis Herring Opened: 2025-11-21 Last modified: 2025-11-26
Priority: Not Prioritized
View all issues with New status.
Discussion:
We do not say that instantiating types like std::tuple<void>
or std::tuple<int()> won't work.
[2025-11-26; Jonathan comments.]
16.4.5.8 [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 16.4.5.8 [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.
Proposed resolution: