Skip to content

Commit e1cfa03

Browse files
committed
Fix compilation with clang-13 and newer.
Drone-CI shows a compilation error with clang-13 and newer. This patch fixes that compilation error and extends the Github-CI to detect this.
1 parent c54307b commit e1cfa03

File tree

2 files changed

+52
-14
lines changed

2 files changed

+52
-14
lines changed

.github/workflows/ubuntu24.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Ubuntu
2+
3+
on:
4+
push:
5+
branches: [ master, develop ]
6+
pull_request:
7+
branches: [ master, develop ]
8+
9+
env:
10+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11+
BUILD_TYPE: Debug
12+
13+
jobs:
14+
build:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
compiler_version: [g++-13, g++-14, clang++-20]
19+
cxx_std: [20, 23]
20+
os: [ubuntu-24.04]
21+
22+
runs-on: ${{ matrix.os }}
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Install Clang 20
27+
id: install_clang_20
28+
if: matrix.compiler_version == 'clang++-20'
29+
shell: bash
30+
working-directory: ${{ env.HOME }}
31+
run: |
32+
wget https://apt.llvm.org/llvm.sh
33+
chmod +x llvm.sh
34+
sudo ./llvm.sh 20
35+
sudo apt-get install libc++-20-dev libc++abi-20-dev libunwind-20-dev
36+
37+
- name: Configure CMake
38+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
39+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
40+
run: |
41+
mkdir build
42+
cd build
43+
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler_version }} -DCXX_STD=${{ matrix.cxx_std }}
44+
45+
- name: Build
46+
run: cd build ; make -j4
47+
48+
- name: Test
49+
run: cd build ; make check

include/boost/parser/search.hpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ namespace boost::parser {
2828
template<
2929
typename R_,
3030
bool ToCommonRange = false,
31-
text::format OtherRangeFormat = no_format,
32-
bool = std::is_same_v<sentinel_t<remove_cv_ref_t<R_>>,
33-
null_sentinel_t> ||
34-
text::detail::is_bounded_array_v<remove_cv_ref_t<R_>>>
31+
text::format OtherRangeFormat = no_format>
3532
struct to_range
3633
{
3734
template<typename R>
@@ -75,22 +72,14 @@ namespace boost::parser {
7572
return BOOST_PARSER_SUBRANGE(first, last) |
7673
as_utf<OtherRangeFormat>;
7774
}
75+
} else if constexpr (OtherRangeFormat == no_format) {
76+
return (R &&) r;
7877
} else {
7978
return (R &&) r | as_utf<OtherRangeFormat>;
8079
}
8180
}
8281
};
8382

84-
template<typename R_, bool ToCommonRange>
85-
struct to_range<R_, ToCommonRange, no_format, false>
86-
{
87-
template<typename R>
88-
static constexpr R && call(R && r)
89-
{
90-
return (R &&) r;
91-
}
92-
};
93-
9483
template<typename R>
9584
using to_range_t = decltype(to_range<R>::call(std::declval<R>()));
9685

0 commit comments

Comments
 (0)