tcbrindle / flux

A C++20 library for sequence-orientated programming
https://tristanbrindle.com/flux/
Boost Software License 1.0
472 stars 29 forks source link

Static assertion build error in Visual Studio 17.7 #117

Closed DeveloperPaul123 closed 1 year ago

DeveloperPaul123 commented 1 year ago

When using the Visual Studio generator to build flux I'm now getting this build error:

flux\test\test_read_only.cpp(132,28): error C2607: static assertion failed
flux\test\test_read_only.cpp(132,28): message : the concept 'std::same_as<std::pair<const int &,const double &>,std::pair<const int &&,const double &&>>' evaluated to false
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.37.32822\include\concepts(36,9): message : 'std::pair<const int &,const double &>' and 'std::pair<const int &&,const double &&>' are different types

The offending code in concepts.hpp. FLUX_HAVE_CPP23_TUPLE_COMMON_REF is true in this context.

#ifdef FLUX_HAVE_CPP23_TUPLE_COMMON_REF
    std::common_reference_with<element_t<Seq>&&, value_t<Seq>&> &&
    std::common_reference_with<rvalue_element_t<Seq>&&, value_t<Seq> const&> &&
#endif
tcbrindle commented 1 year ago

Thanks @DeveloperPaul123, not sure how I missed this when I was testing the new VS release the other day!

I get the same thing when compiling with GCC13 in C++23 mode. It looks like the culprit was #97, which removed the move_at() specialisation for read_only_adaptor.

(As an aside: perhaps it's worth running CI with both CXX_STANDARD=20 and CXX_STANDARD=23 on the latest compilers to catch things like this?)

tcbrindle commented 1 year ago

This should now be fixed, but please let me know if there are any other problems. Thanks again for the report.