Skip to content

fix: GCC 16 / C++20 build failure with u8 string literals#1685

Merged
baylesj merged 3 commits into
masterfrom
fix-cpp20-build
May 14, 2026
Merged

fix: GCC 16 / C++20 build failure with u8 string literals#1685
baylesj merged 3 commits into
masterfrom
fix-cpp20-build

Conversation

@baylesj
Copy link
Copy Markdown
Contributor

@baylesj baylesj commented May 14, 2026

In C++20, the u8"" string literal prefix was changed to evaluate to const char8_t[] instead of const char[]. This caused compilation errors when these literals were implicitly converted to std::string or passed to functions expecting const char*.

This commit adds reinterpret_cast<const char*> around the u8 string literals in the test suite to resolve the build errors while maintaining the intended UTF-8 semantics.

Additionally, this adds C++20 to the GitHub Actions CMake test matrix to ensure we don't regress on newer standards.

Fixes #1684

In C++20, the `u8""` string literal prefix was changed to evaluate to `const char8_t[]` instead of `const char[]`. This caused compilation errors when these literals were implicitly converted to `std::string` or passed to functions expecting `const char*`.

This commit adds `reinterpret_cast<const char*>` around the `u8` string literals in the test suite to resolve the build errors while maintaining the intended UTF-8 semantics.

Additionally, this adds C++20 to the GitHub Actions CMake test matrix to ensure we don't regress on newer standards.

Fixes #1684
@coveralls
Copy link
Copy Markdown

coveralls commented May 14, 2026

Coverage Report for CI Build 25890359454

Coverage remained the same at 90.149%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 2709
Covered Lines: 2592
Line Coverage: 95.68%
Relevant Branches: 2600
Covered Branches: 2194
Branch Coverage: 84.38%
Branches in Coverage %: Yes
Coverage Strength: 23581.95 hits per line

💛 - Coveralls

@baylesj baylesj merged commit 71d46ca into master May 14, 2026
48 checks passed
@baylesj baylesj deleted the fix-cpp20-build branch May 14, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build fails with GCC 16

2 participants