<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/99430>99430</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] clang-cl main branch refuses to compile MSVC's tuple template when targeting C++23
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tycho
</td>
</tr>
</table>
<pre>
Something regressed recently with regards to compiling the Visual Studio 2022 (17.10.4) implementation of `std::tuple` and `std::tie` when using `/std:c++latest`.
I rebuild my LLVM toolchain every couple of weeks or so. This is the revision I tested today, where I first noticed this problem:
```
llvmorg-19-init-17993-gedfe25064e13
```
This is the revision I have been using for the past few weeks, which did **not** fail to compile this test case:
```
llvmorg-19-init-16022-g2051736f7bc3
```
Command line:
```
> clang-cl /std:c++latest /c test.cpp
```
Mostly minimized testcase:
```c++
#include <tuple>
struct Version {
unsigned int major = 0;
unsigned int minor = 0;
unsigned int release = 0;
unsigned int patch = 0;
constexpr auto operator<=>(const Version &_other) const
{
return std::tuple(major, minor, release, patch) <=> std::tuple(_other.major, _other.minor, _other.release, _other.patch);
}
};
```
Result:
```
In file included from test.cpp:1:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(208,101): error: pack expansion contains
parameter packs '_TTypes' and '_Indices' that have different lengths (1 vs. 4)
208 | (requires { typename _Synth_three_way_result<_TTypes, tuple_element_t<_Indices, _UTuple>>; } && ...)
| ~~~~~~~ ~~~~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(214,1): note: while checking constraint
satisfaction for class template partial specialization '_Three_way_comparison_result_with_tuple_like<unsigned int, std::tuple<unsigned int,
unsigned int, unsigned int, unsigned int>, 0ULL, 1ULL, 2ULL, 3ULL>' required here
214 | using _Three_way_comparison_result_with_tuple_like_t =
| ^~~~~
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(214,1): note: during template argument deduction
for class template partial specialization '_Three_way_comparison_result_with_tuple_like<tuple<_TTypes...>, _UTuple,
index_sequence<_Indices...>>' [with _TTypes = <unsigned int>, _UTuple = std::tuple<unsigned int, unsigned int, unsigned int, unsigned int>,
_Indices = <0, 1, 2, 3>]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(214,1): note: in instantiation of template class
'std::_Three_way_comparison_result_with_tuple_like<std::tuple<unsigned int>, std::tuple<unsigned int, unsigned int, unsigned int, unsigned
int>>' requested here
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(804,12): note: in instantiation of template type
alias '_Three_way_comparison_result_with_tuple_like_t' requested here
804 | -> _Three_way_comparison_result_with_tuple_like_t<tuple, _Other> {
| ^
test.cpp(11,51): note: while substituting deduced template arguments into function template 'operator<=>' [with _Other = std::tuple<unsigned int,
unsigned int, unsigned int, unsigned int>]
11 | return std::tuple(major, minor, release, patch) <=> std::tuple(_other.major, _other.minor, _other.release, _other.patch);
| ^
In file included from test.cpp:1:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(208,101): error: pack expansion contains
parameter packs '_TTypes' and '_Indices' that have different lengths (2 vs. 4)
208 | (requires { typename _Synth_three_way_result<_TTypes, tuple_element_t<_Indices, _UTuple>>; } && ...)
| ~~~~~~~ ~~~~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(214,1): note: while checking constraint
satisfaction for class template partial specialization '_Three_way_comparison_result_with_tuple_like<unsigned int, unsigned int,
std::tuple<unsigned int, unsigned int, unsigned int, unsigned int>, 0ULL, 1ULL, 2ULL, 3ULL>' required here
214 | using _Three_way_comparison_result_with_tuple_like_t =
| ^~~~~
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(214,1): note: during template argument deduction
for class template partial specialization '_Three_way_comparison_result_with_tuple_like<tuple<_TTypes...>, _UTuple,
index_sequence<_Indices...>>' [with _TTypes = <unsigned int, unsigned int>, _UTuple = std::tuple<unsigned int, unsigned int, unsigned int,
unsigned int>, _Indices = <0, 1, 2, 3>]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(214,1): note: in instantiation of template class
'std::_Three_way_comparison_result_with_tuple_like<std::tuple<unsigned int, unsigned int>, std::tuple<unsigned int, unsigned int, unsigned
int, unsigned int>>' requested here
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(804,12): note: in instantiation of template type
alias '_Three_way_comparison_result_with_tuple_like_t' requested here
804 | -> _Three_way_comparison_result_with_tuple_like_t<tuple, _Other> {
| ^
test.cpp(11,51): note: while substituting deduced template arguments into function template 'operator<=>' [with _Other = std::tuple<unsigned int,
unsigned int, unsigned int, unsigned int>]
11 | return std::tuple(major, minor, release, patch) <=> std::tuple(_other.major, _other.minor, _other.release, _other.patch);
| ^
In file included from test.cpp:1:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(208,101): error: pack expansion contains
parameter packs '_TTypes' and '_Indices' that have different lengths (3 vs. 4)
208 | (requires { typename _Synth_three_way_result<_TTypes, tuple_element_t<_Indices, _UTuple>>; } && ...)
| ~~~~~~~ ~~~~~~~~ ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(214,1): note: while checking constraint
satisfaction for class template partial specialization '_Three_way_comparison_result_with_tuple_like<unsigned int, unsigned int, unsigned
int, std::tuple<unsigned int, unsigned int, unsigned int, unsigned int>, 0ULL, 1ULL, 2ULL, 3ULL>' required here
214 | using _Three_way_comparison_result_with_tuple_like_t =
| ^~~~~
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(214,1): note: during template argument deduction
for class template partial specialization '_Three_way_comparison_result_with_tuple_like<tuple<_TTypes...>, _UTuple,
index_sequence<_Indices...>>' [with _TTypes = <unsigned int, unsigned int, unsigned int>, _UTuple = std::tuple<unsigned int, unsigned int,
unsigned int, unsigned int>, _Indices = <0, 1, 2, 3>]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(214,1): note: in instantiation of template class
'std::_Three_way_comparison_result_with_tuple_like<std::tuple<unsigned int, unsigned int, unsigned int>, std::tuple<unsigned int, unsigned
int, unsigned int, unsigned int>>' requested here
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\tuple(804,12): note: in instantiation of template type
alias '_Three_way_comparison_result_with_tuple_like_t' requested here
804 | -> _Three_way_comparison_result_with_tuple_like_t<tuple, _Other> {
| ^
test.cpp(11,51): note: while substituting deduced template arguments into function template 'operator<=>' [with _Other = std::tuple<unsigned int,
unsigned int, unsigned int, unsigned int>]
11 | return std::tuple(major, minor, release, patch) <=> std::tuple(_other.major, _other.minor, _other.release, _other.patch);
| ^
3 errors generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWt9v2zgS_mvol0EMiZIs-8EPiZwAAVrc4Zrtq0FTI4tbitSSVFLvw_7tB1Lyj7hO27S52x5ORmBZ0pCc4ffNzIeAzFqxVYhLkt2QbDVhnau1Wbodr_Vko8vd8oNu0NVCbcHg1qC1WIJBjsrJHTwJV_vnzJQWnAaum1ZIb-xqhI_CdkzCB9eVQgONKAVC53E-jaNpSugCRNNKbFA55oRWoCsgs8i6kiTXJLl2XSuRzCJgqnz-QoTHTzUq6KxfjcwiQu96A07oDaE3kjm0jsyiKYlWJLruv-_B4KYTsoRmB-_efXwPTmvJayYU4COaHXDtl_W-PCF-sqANWD2Fh1pYEDbEZfBRWO_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