Closed
Description
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:
#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.