Skip to content

Fix gcc 12 compiling error #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion .github/workflows/targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: GCC 4.8
runs-on: ubuntu-latest
container:
image: ubuntu:18.04
image: ubuntu:bionic-20230530 # 18.04
env:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8
Expand All @@ -43,3 +43,33 @@ jobs:
run: |
CC=gcc-4.8 CXX=g++-4.8 cmake . -DTEST:STRING="defaults-enabled"
cmake --build .

gcc-12:
runs-on: ubuntu-latest
container:
image: ubuntu:jammy-20231004 # 22.04
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
steps:
- run: |
apt-get update
apt-get install -y g++-12 wget make libssl-dev
- uses: actions/checkout@v3
- uses: ./.github/actions/install/cmake
with:
version: "3.26.3"
url: "https://cmake.org/files/v3.26/cmake-3.26.3.tar.gz"

- name: setup
run: |
mkdir build
cd build
cmake ..
cmake --install .

- name: test
working-directory: tests/cmake
run: |
CC=gcc-12 CXX=g++-12 cmake . -DCMAKE_CXX_STANDARD=20 -DTEST:STRING="defaults-enabled"
cmake --build .
8 changes: 4 additions & 4 deletions include/jwt-cpp/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace jwt {
return data;
}
static const std::string& fill() {
static std::string fill{"="};
static const std::string fill{"="};
return fill;
}
};
Expand All @@ -62,7 +62,7 @@ namespace jwt {
return data;
}
static const std::string& fill() {
static std::string fill{"%3d"};
static const std::string fill{"%3d"};
return fill;
}
};
Expand All @@ -82,8 +82,8 @@ namespace jwt {
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'}};
return data;
}
static const std::initializer_list<std::string>& fill() {
static std::initializer_list<std::string> fill{"%3D", "%3d"};
static const std::vector<std::string>& fill() {
static const std::vector<std::string> fill{"%3D", "%3d"};
return fill;
}
};
Expand Down