diff --git a/.github/workflows/ubuntu24.yml b/.github/workflows/ubuntu24.yml new file mode 100644 index 00000000..aa22d984 --- /dev/null +++ b/.github/workflows/ubuntu24.yml @@ -0,0 +1,49 @@ +name: Ubuntu + +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Debug + +jobs: + build: + strategy: + fail-fast: false + matrix: + compiler_version: [g++-13, g++-14, clang++-20] + cxx_std: [20, 23] + os: [ubuntu-24.04] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - name: Install Clang 20 + id: install_clang_20 + if: matrix.compiler_version == 'clang++-20' + shell: bash + working-directory: ${{ env.HOME }} + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 20 + sudo apt-get install libc++-20-dev libc++abi-20-dev libunwind-20-dev + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: | + mkdir build + cd build + cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler_version }} -DCXX_STD=${{ matrix.cxx_std }} + + - name: Build + run: cd build ; make -j4 + + - name: Test + run: cd build ; make check diff --git a/include/boost/parser/detail/text/detail/all_t.hpp b/include/boost/parser/detail/text/detail/all_t.hpp index 7e65b607..1e7d2fb4 100644 --- a/include/boost/parser/detail/text/detail/all_t.hpp +++ b/include/boost/parser/detail/text/detail/all_t.hpp @@ -42,8 +42,9 @@ namespace boost::parser::detail::text::detail { template constexpr bool view = #if BOOST_PARSER_DETAIL_TEXT_USE_CONCEPTS || \ - (defined(__cpp_lib_concepts) && \ - (!defined(BOOST_PARSER_GCC) || 12 <= __GNUC__)) + (defined(__cpp_lib_ranges) && \ + (!defined(BOOST_PARSER_GCC) || 12 <= __GNUC__) && \ + (!defined(__clang_major__) || 16 <= __clang_major__)) std::ranges::view #else range_ && !container_ && diff --git a/include/boost/parser/search.hpp b/include/boost/parser/search.hpp index ef54c945..b7e4fe64 100644 --- a/include/boost/parser/search.hpp +++ b/include/boost/parser/search.hpp @@ -25,13 +25,16 @@ namespace boost::parser { constexpr auto as_utf = text::detail::as_utf_impl{}; + template + constexpr bool has_special_sentinel_v = + std::is_same_v>, null_sentinel_t> || + text::detail::is_bounded_array_v>; + template< typename R_, bool ToCommonRange = false, text::format OtherRangeFormat = no_format, - bool = std::is_same_v>, - null_sentinel_t> || - text::detail::is_bounded_array_v>> + bool HasSpecialSentinel = has_special_sentinel_v> struct to_range { template @@ -39,7 +42,8 @@ namespace boost::parser { { static_assert(std::is_same_v); using T = remove_cv_ref_t; - if constexpr (std::is_same_v, null_sentinel_t>) { + if constexpr (HasSpecialSentinel && + std::is_same_v, null_sentinel_t>) { auto plus_strlen = [](auto * ptr) { while (*ptr) { ++ptr; @@ -63,7 +67,8 @@ namespace boost::parser { return (R &&) r | as_utf; } } - } else if constexpr (text::detail::is_bounded_array_v) { + } else if constexpr (HasSpecialSentinel && + text::detail::is_bounded_array_v) { auto const first = std::begin(r); auto last = std::end(r); constexpr auto n = std::extent_v; @@ -75,22 +80,14 @@ namespace boost::parser { return BOOST_PARSER_SUBRANGE(first, last) | as_utf; } + } else if constexpr (OtherRangeFormat == no_format) { + return (R &&) r; } else { return (R &&) r | as_utf; } } }; - template - struct to_range - { - template - static constexpr R && call(R && r) - { - return (R &&) r; - } - }; - template using to_range_t = decltype(to_range::call(std::declval()));