forked from lwg/issues
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New issue from Jiang An: "Contradictory specification of std::tuple_s…
…ize"
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version='1.0' encoding='utf-8' standalone='no'?> | ||
<!DOCTYPE issue SYSTEM "lwg-issue.dtd"> | ||
|
||
<issue num="4040" status="New"> | ||
<title>Contradictory specification of <tt>std::tuple_size</tt></title> | ||
<section><sref ref="[ostream.formatted.print]"/></section> | ||
<submitter>Jiang An</submitter> | ||
<date>20 Jan 2024</date> | ||
<priority>99</priority> | ||
|
||
<discussion> | ||
<p> | ||
<sref ref="[tuple.helper]"/>/1 currently says: | ||
</p> | ||
<blockquote> | ||
<p> | ||
All specializations of <tt>tuple_size</tt> meet the <i>Cpp17UnaryTypeTrait</i> requirements | ||
(<sref ref="[meta.rqmts]"/>) with a base characteristic of <tt>integral_constant<size_t, N></tt> | ||
for some <tt>N</tt>. | ||
</p> | ||
</blockquote> | ||
<p> | ||
which is probably wrong for <tt>std::tuple_size<int></tt> and | ||
<tt>std::tuple_size<std::vector<int>></tt> whose definitions are not provided, and | ||
contradicts with <sref ref="[tuple.helper]"/>/4 | ||
</p> | ||
<blockquote> | ||
<p> | ||
[…] Otherwise, it has no member <tt>value</tt>. | ||
</p> | ||
</blockquote> | ||
<p> | ||
Also, there's currently implementation divergence on whether <tt>std::tuple_size<<i>cv</i> T></tt> | ||
is a complete type when <tt>std::tuple_size<T>::value</tt> is absent (related to LWG <iref ref="2770"/>). | ||
Some implementations (e.g. | ||
<a href="https://github.com/llvm/llvm-project/blob/b1d4265a5f5345065e5c2aedf50787da05ddcc08/libcxx/include/__tuple/tuple_size.h#L29-L47">libc++</a> | ||
and <a href="https://github.com/gcc-mirror/gcc/blob/615e25c82de97acc17ab438f88d6788cf7ffe1d6/libstdc%2B%2B-v3/include/bits/utility.h#L55-L71">libstdc++</a>) | ||
treat <sref ref="[tuple.helper]"/>/4 and <sref ref="[depr.tuple]"/>/2 as "<tt>std::tuple_size<<i>cv</i> T></tt> | ||
is generated from partial specializations only if <tt>std::tuple_size<T></tt> meets the aforementioned conditions", | ||
while others (e.g. <a href="https://github.com/microsoft/STL/blob/442029c6fa37f1b6f9203357de09672d5704077c/stl/inc/utility#L598-L612">MSVC STL</a>) | ||
always consider <tt>std::tuple_size<<i>cv</i> T></tt> needs to be defined. The latter | ||
reading seems to be justified by <sref ref="[contents]"/>/1 and <sref ref="[tuple.syn]"/>. | ||
</p> | ||
</discussion> | ||
|
||
<resolution> | ||
</resolution> | ||
|
||
</issue> |