Skip to content

Commit 0e3d6a1

Browse files
Fix gcc-12 compilation error (#312)
* Fix gcc 12 compiling error * add test for gcc-12 * replace array with vector this is to avoid breaking the API down the line * pin down ubuntu base images these do get updated with with under active development and there are changes which could affect us * skip gtest + set cxx_std to 20 --------- Co-authored-by: Chris Mc <[email protected]>
1 parent ce1f9df commit 0e3d6a1

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

.github/workflows/targets.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: GCC 4.8
1919
runs-on: ubuntu-latest
2020
container:
21-
image: ubuntu:18.04
21+
image: ubuntu:bionic-20230530 # 18.04
2222
env:
2323
CC: /usr/bin/gcc-4.8
2424
CXX: /usr/bin/g++-4.8
@@ -43,3 +43,33 @@ jobs:
4343
run: |
4444
CC=gcc-4.8 CXX=g++-4.8 cmake . -DTEST:STRING="defaults-enabled"
4545
cmake --build .
46+
47+
gcc-12:
48+
runs-on: ubuntu-latest
49+
container:
50+
image: ubuntu:jammy-20231004 # 22.04
51+
env:
52+
CC: /usr/bin/gcc-12
53+
CXX: /usr/bin/g++-12
54+
steps:
55+
- run: |
56+
apt-get update
57+
apt-get install -y g++-12 wget make libssl-dev
58+
- uses: actions/checkout@v3
59+
- uses: ./.github/actions/install/cmake
60+
with:
61+
version: "3.26.3"
62+
url: "https://cmake.org/files/v3.26/cmake-3.26.3.tar.gz"
63+
64+
- name: setup
65+
run: |
66+
mkdir build
67+
cd build
68+
cmake ..
69+
cmake --install .
70+
71+
- name: test
72+
working-directory: tests/cmake
73+
run: |
74+
CC=gcc-12 CXX=g++-12 cmake . -DCMAKE_CXX_STANDARD=20 -DTEST:STRING="defaults-enabled"
75+
cmake --build .

include/jwt-cpp/base.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace jwt {
3939
return data;
4040
}
4141
static const std::string& fill() {
42-
static std::string fill{"="};
42+
static const std::string fill{"="};
4343
return fill;
4444
}
4545
};
@@ -62,7 +62,7 @@ namespace jwt {
6262
return data;
6363
}
6464
static const std::string& fill() {
65-
static std::string fill{"%3d"};
65+
static const std::string fill{"%3d"};
6666
return fill;
6767
}
6868
};
@@ -82,8 +82,8 @@ namespace jwt {
8282
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'}};
8383
return data;
8484
}
85-
static const std::initializer_list<std::string>& fill() {
86-
static std::initializer_list<std::string> fill{"%3D", "%3d"};
85+
static const std::vector<std::string>& fill() {
86+
static const std::vector<std::string> fill{"%3D", "%3d"};
8787
return fill;
8888
}
8989
};

0 commit comments

Comments
 (0)