fix: GCC 16 / C++20 build failure with u8 string literals#1685
Merged
Conversation
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
Coverage Report for CI Build 25890359454Coverage remained the same at 90.149%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In C++20, the
u8""string literal prefix was changed to evaluate toconst char8_t[]instead ofconst char[]. This caused compilation errors when these literals were implicitly converted tostd::stringor passed to functions expectingconst char*.This commit adds
reinterpret_cast<const char*>around theu8string 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