ericniebler / range-v3

Range library for C++14/17/20, basis for C++20's std::ranges
Other
4.05k stars 437 forks source link

Range-v3 fails to compile on the latest MSVC version with Visual Studio 2022 #1806

Closed KKhanhH closed 3 weeks ago

KKhanhH commented 6 months ago

I'm getting an error building range-v3 using the latest version of MSVC with Visual Studio 2022. Running the build on the latest version of MSVC with Visual Studio 2019 works fine.

Looks like it might be related to this issue https://developercommunity.visualstudio.com/t/MSVC-compiler-bug---parameter-pack-expan/10419008?q=intellisense&sort=newest

Error Log:

cl.exe failed: error executing CppCompile command (from target ...) C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\HostX64\x64\cl.exe ... (remaining 1 argument skipped)
...\range-v3\include\range/v3/utility/compressed_pair.hpp(56): error C3546: '...': there are no parameter packs available to expand
...\range-v3\include\range/v3/utility/compressed_pair.hpp(56): note: the template instantiation context (the oldest one first) is
...\range-v3\include\range/v3/utility/compressed_pair.hpp(92): note: see reference to class template instantiation 'ranges::compressed_tuple_detail::compressed_tuple_<meta::list<Args...>,std::integer_sequence<size_t,_Kx...>>' being compiled
...\range-v3\include\range/v3/utility/compressed_pair.hpp(65): error C3546: '...': there are no parameter packs available to expand
Agritite commented 1 month ago

It seems like if you're compiling with /std:c++17 or below you need /permissive-.

KKhanhH commented 3 weeks ago

Ah thanks, that seems to have fixed it. I didn't realize you needed the standards conformance flag because the same code was compiling fine with VS 2019.