TartanLlama/ranges

Compile with windows fails

Opened this issue · 2 comments

Hi there. Thanks first of all for the cool work done here !
In our production code we are using cpp 20 and I wanted by including this library allow for the use of ranges which in 20 are arguably a great extension but somewhat clunk to use without additional views.

I managed to have a stable compile workflow for both Linux gcc in various versions and also linux clang in various versions.
Now the last step is to allow the section of our team that uses the msvc to enjoy the libary too. However I hit a roadblock since I can not seem to manage to get even the test suit compiling. Any help is appreciated :)

Note. We already have a tl namespace in our code so I renamed it to ranges_additional.

System:
Windows SDK version 10.0.20348.0 to target Windows 10.0.19045.
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows

while the compile error happens at another point its rootcause is the same.

/test/adjacent.cpp:line:22
for (auto const& [a,b] : ranges_additional::views::zip(ranges_additional::views::adjacent<3>(a), results)) { REQUIRE(a == b); }
The error message the msvc gives is following

[build] C:\Users\z004esee\ranges_additional\test\adjacent.cpp(22,58): error C2064: term does not evaluate to a function taking 2 arguments [C:\Users\z004esee\ranges_additional\build\build\test\ranges_additional.unit_tests.vcxproj] [build] C:\Users\z004esee\ranges_additional\test\adjacent.cpp(22,58): message : class does not define an 'operator()' or a user defined conversion operator to a pointer-to-function or reference-to-function that takes appropriate number of arguments [C:\Users\z004esee\ranges_additional\build\build\test\ranges_additional.unit_tests.vcxproj] [build] C:\Users\z004esee\ranges_additional\src\ranges_additional/zip.hpp(174,31): message : could be 'auto ranges_additional::views::detail::zip_fn::operator ()(V &&...) const' [C:\Users\z004esee\ranges_additional\build\build\test\ranges_additional.unit_tests.vcxproj] [build] C:\Users\z004esee\ranges_additional\test\adjacent.cpp(22,58): message : the associated constraints are not satisfied [C:\Users\z004esee\ranges_additional\build\build\test\ranges_additional.unit_tests.vcxproj] [build] C:\Users\z004esee\ranges_additional\src\ranges_additional/zip.hpp(173,23): message : the constraint was not satisfied [C:\Users\z004esee\ranges_additional\build\build\test\ranges_additional.unit_tests.vcxproj] [build] C:\Users\z004esee\ranges_additional\test\adjacent.cpp(22,58): message : while trying to match the argument list '(ranges_additional::adjacent_view<std::ranges::ref_view<std::vector<int,std::allocator<int>>>,3>, std::vector<std::tuple<int,int,int>,std::allocator<std::tuple<int,int,int>>>)' [C:\Users\z004esee\ranges_additional\build\build\test\ranges_additional.unit_tests.vcxproj] [build] C:\Users\z004esee\ranges_additional\test\adjacent.cpp(22,27): error C2059: syntax error: ':' [C:\Users\z004esee\ranges_additional\build\build\test\ranges_additional.unit_tests.vcxproj] [build] C:\Users\z004esee\ranges_additional\test\adjacent.cpp(23,4): error C2143: syntax error: missing ';' before '{' [C:\Users\z004esee\ranges_additional\build\build\test\ranges_additional.unit_tests.vcxproj] [build] C:\Users\z004esee\ranges_additional\test\adjacent.cpp(24,7): error C2065: 'b': undeclared identifier [C:\Users\z004esee\ranges_additional\build\build\test\ranges_additional.unit_tests.vcxproj]

Hm, it works for me on MSVC. Can you share exactly which compiler version you're using? You can open a Developer Command Prompt and run cl:

C:\Program Files\Microsoft Visual Studio\2022\Preview>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32502 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

Sure.
Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31935 for x86 Copyright (C) Microsoft Corporation. All rights reserved.