llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.02k stars 11.57k forks source link

Clang 17.0.6 incompatibility with msvc-14.38.33130 standard library #78700

Open hofst opened 8 months ago

hofst commented 8 months ago

Clang 17.0.6 (=latest available version) is incompatible with msvc-14.38.33130 standard library (=latest available version) when using ranges::views::zip. The reported error is:

msvc/include\ranges:8217:26: error: requires clause differs in template redeclaration
 8217 |                 requires _Zip_transform_constraints<_Func, _OtherViews...>
msvc/include\ranges:8619:18: note: previous template declaration is here
 8619 |         requires _Zip_transform_constraints<_Func, _ViewTypes...>

A repro can be as simple as:

   vector<int> i{1,2,3,4};
   vector<int> j{1,2,3,4};
   for (const auto& [a, b] : ranges::views::zip(i, j)) {
      cout << a << " " << b << endl;
   }
llvmbot commented 8 months ago

@llvm/issue-subscribers-clang-frontend

Author: Sebastian Hofstetter (hofst)

Clang 17.0.6 (=latest available version) is incompatible with msvc-14.38.33130 standard library (=latest available version) when using `ranges::views::zip`. The reported error is: ``` msvc/include\ranges:8217:26: error: requires clause differs in template redeclaration 8217 | requires _Zip_transform_constraints<_Func, _OtherViews...> msvc/include\ranges:8619:18: note: previous template declaration is here 8619 | requires _Zip_transform_constraints<_Func, _ViewTypes...> ``` A repro can be as simple as: ``` vector<int> i{1,2,3,4}; vector<int> j{1,2,3,4}; for (const auto& [a, b] : ranges::views::zip(i, j)) { cout << a << " " << b << endl; } ```
shafik commented 8 months ago

CC @AaronBallman

cor3ntin commented 7 months ago

CC @CaseyCarter

CaseyCarter commented 7 months ago

This is due to #61763, which I believe has been fixed for LLVM 18. We applied a workaround to the STL in https://github.com/microsoft/STL/pull/4014, which unfortunately didn't make the VS 2022 v17.8 release. It is available in the 17.9 previews, if that helps.

cor3ntin commented 7 months ago

@CaseyCarter thanks ! I think that answers the user's question (and we have no way to fix clang 17 on our side either at this stage)

DeveloperPaul123 commented 4 months ago

We are seeing this same issue with Clang 18.1.4 and MSVC-14.38.33130

Error: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\ranges:8217:26: error: requires clause differs in template redeclaration
 8217 |                 requires _Zip_transform_constraints<_Func, _OtherViews...>
      |                          ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\ranges:8514:31: note: in instantiation of template class 'std::ranges::zip_view<std::ranges::ref_view<std::vector<std::filesystem::path>>, std::ranges::ref_view<std::vector<murisuite::Beam>>>::_Iterator<true>' requested here
 8514 |             noexcept(noexcept(_Iterator<true>{_Tuple_transform(_RANGES begin, _Views)})) // strengthened
      |                               ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\ranges:8513:35: note: in instantiation of exception specification for 'begin' requested here
 8513 |         _NODISCARD constexpr auto begin() const
      |                                   ^
D:/a/MuriSuite/MuriSuite/utilities/communication/tests/communicationtests.cpp:260:27: note: in instantiation of member function 'std::ranges::zip_view<std::ranges::ref_view<std::vector<std::filesystem::path>>, std::ranges::ref_view<std::vector<murisuite::Beam>>>::begin' requested here
  260 |     for(auto [path, beam] : std::views::zip(raysearch_paths, correct_beams))
      |                           ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\ranges:8619:18: note: previous template declaration is here
 8619 |         requires _Zip_transform_constraints<_Func, _ViewTypes...>
      |                  ^
Error: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\ranges:8217:26: error: requires clause differs in template redeclaration
 8217 |                 requires _Zip_transform_constraints<_Func, _OtherViews...>
      |                          ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\ranges:8514:47: note: in instantiation of template class 'std::ranges::zip_view<std::ranges::ref_view<std::vector<std::filesystem::path>>, std::ranges::ref_view<std::vector<murisuite::Beam>>>::_Iterator<false>' requested here
 8514 |             noexcept(noexcept(_Iterator<true>{_Tuple_transform(_RANGES begin, _Views)})) // strengthened
      |                                               ^
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\ranges:8513:35: note: in instantiation of exception specification for 'begin' requested here
 8513 |         _NODISCARD constexpr auto begin() const   
AaronBallman commented 4 months ago

CC @erichkeane

CaseyCarter commented 1 month ago

We are seeing this same issue with Clang 18.1.4 and MSVC-14.38.33130

The workaround shipped in VS 17.9p1 and is still present today, so you should be fine with any version of MSVC more recent than 17.8.