Skip to content

Commit 2f89799

Browse files
committed
Add more discussion to 4479
1 parent 1cf4325 commit 2f89799

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

xml/issue4479.xml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,36 @@
22
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
33

44
<issue num="4479" status="New">
5-
<title>No restrictions on which types can be `tuple` elements</title>
5+
<title>Missing restrictions on which types can be `tuple` elements</title>
66
<section><sref ref="[tuple.tuple.general]"/></section>
77
<submitter>Davis Herring</submitter>
88
<date>21 Nov 2025</date>
99
<priority>99</priority>
1010

1111
<discussion>
1212
<p>
13-
We do not prohibit nonsense like <code>std::tuple&lt;void&gt;</code>
14-
or <code>std::tuple&lt;int()&gt;</code>.
13+
We do not say that instantiating types like <code>std::tuple&lt;void&gt;</code>
14+
or <code>std::tuple&lt;int()&gt;</code> won't work.
15+
</p>
16+
17+
18+
<note>2025-11-26; Jonathan comments.</note>
19+
<p>
20+
<sref ref="[res.on.functions]"/> already makes it undefined behaviour to
21+
instantiate `tuple` with an incomplete type, which includes `void` and `int[]`.
22+
It would be better if it was ill-formed not undefined though, and that doesn't
23+
say anything about <code>tuple&lt;int()&gt;</code> or
24+
<code>tuple&lt;AbstractClassType&gt;</code>.
25+
Any restrictions should only apply when `tuple` is instantiated,
26+
not just when it's declared, as that would prevent using it as a typelist.
27+
</p>
28+
<p>
29+
We might need to specify that `tuple_size` and `tuple_element` can be
30+
instantiated with incomplete types that are specializations of `tuple`,
31+
because otherwise <sref ref="[res.on.functions]"/> makes that undefined.
32+
`tuple_size` and `tuple_element` don't need a complete `tuple` type
33+
to give an answer, and they don't need to instantiate a `tuple` type.
34+
So <code>tuple_element_t&lt;0, tuple&lt;void&gt;&gt;</code> should work.
1535
</p>
1636
</discussion>
1737

0 commit comments

Comments
 (0)