boostorg / parser

A C++ parser combinator library.
Boost Software License 1.0
96 stars 14 forks source link

MSVC Compiler 2022 C++23 compilation error #175

Closed d5ch4k closed 1 month ago

d5ch4k commented 6 months ago

The MSVC compiler 2022 C++23 cannot compile the following lines from e.g. test/transform_replace.cpp, test/split.cpp, test/search.cpp

        char const * str_ = "XYZ";
        auto str = str_ | bp::as_utf8;

as it cannot find a suitable pipe operator however, using a fixed size array char const str_[] = "XYZ" works fine

d5ch4k commented 6 months ago

the compiler activates BOOST_PARSER_USE_CPP23_STD_RANGE_ADAPTOR_CLOSURE

#if BOOST_PARSER_USE_CONCEPTS && defined(__cpp_lib_ranges) &&                  \
    202202L <= __cpp_lib_ranges
#define BOOST_PARSER_USE_CPP23_STD_RANGE_ADAPTOR_CLOSURE 1
#else
#define BOOST_PARSER_USE_CPP23_STD_RANGE_ADAPTOR_CLOSURE 0
#endif

in view_adaptor.hpp as it returns 202302L for __cpp_lib_ranges and switches to the stl std::ranges::_Pipe operators

tzlaine commented 1 month ago

The proper fix for this is probably #190.