Skip to content

Commit e2ec22c

Browse files
committed
bug fix
1 parent 6262493 commit e2ec22c

File tree

2 files changed

+53
-6
lines changed

2 files changed

+53
-6
lines changed

.github/workflows/build.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
strategy:
10+
matrix:
11+
compiler:
12+
- { name: gcc, version: 11}
13+
- { name: gcc, version: 12}
14+
- { name: gcc, version: 13}
15+
- { name: gcc, version: 14}
16+
- { name: clang, version: 16}
17+
- { name: clang, version: 17}
18+
- { name: clang, version: 18}
19+
name: Build (${{ matrix.compiler.name }} ${{ matrix.compiler.version }})
20+
runs-on: ubuntu-24.04
21+
steps:
22+
- name: Install dependencies
23+
run: |
24+
sudo add-apt-repository universe
25+
sudo apt-get update
26+
sudo apt-get install --assume-yes --no-install-recommends ca-certificates cmake git
27+
- name: Install GCC
28+
if: ${{ matrix.compiler.name == 'gcc' }}
29+
run: |
30+
sudo apt-get install --assume-yes --no-install-recommends gcc-${{ matrix.compiler.version }} g++-${{ matrix.compiler.version }}
31+
echo "CC=/usr/bin/gcc-${{ matrix.compiler.version }}" >> $GITHUB_ENV
32+
echo "CXX=/usr/bin/g++-${{ matrix.compiler.version }}" >> $GITHUB_ENV
33+
- name: Install Clang
34+
if: ${{ matrix.compiler.name == 'clang' }}
35+
run: |
36+
sudo apt-get install --assume-yes --no-install-recommends clang-${{ matrix.compiler.version }}
37+
echo "CC=/usr/bin/clang-${{ matrix.compiler.version }}" >> $GITHUB_ENV
38+
echo "CXX=/usr/bin/clang++-${{ matrix.compiler.version }}" >> $GITHUB_ENV
39+
- uses: actions/checkout@v4
40+
with:
41+
submodules: recursive
42+
- name: Build
43+
run: |
44+
cmake -B ./build
45+
cmake --build ./build --parallel

include/parser.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,17 @@ struct parser {
125125
} else if constexpr (std::is_same<T, char>::value || std::is_same<T, signed char>::value ||
126126
std::is_same<T, unsigned char>::value) {
127127
return value.front();
128-
} else if constexpr (std::is_same<T, unsigned int>::value || std::is_same<T, int>::value ||
129-
std::is_same<T, unsigned short int>::value ||
130-
std::is_same<T, short int>::value) {
128+
} else if constexpr (std::is_same<T, int>::value || std::is_same<T, short int>::value) {
131129
return std::strtol(value.c_str(), nullptr, 10);
132-
} else if constexpr (std::is_same<T, unsigned long int>::value ||
133-
std::is_same<T, long int>::value ||
134-
std::is_same<T, unsigned long long int>::value ||
130+
} else if constexpr (std::is_same<T, unsigned int>::value ||
131+
std::is_same<T, unsigned short int>::value) {
132+
return std::strtoul(value.c_str(), nullptr, 10);
133+
} else if constexpr (std::is_same<T, long int>::value ||
135134
std::is_same<T, long long int>::value) {
136135
return std::strtoll(value.c_str(), nullptr, 10);
136+
} else if constexpr (std::is_same<T, unsigned long int>::value ||
137+
std::is_same<T, unsigned long long int>::value) {
138+
return std::strtoull(value.c_str(), nullptr, 10);
137139
} else if constexpr (std::is_same<T, float>::value || std::is_same<T, double>::value ||
138140
std::is_same<T, long double>::value) {
139141
return std::strtod(value.c_str(), nullptr);

0 commit comments

Comments
 (0)