Skip to content

Commit

Permalink
CI linux: add clang++-11 C++20 (with LLVM libc++) build
Browse files Browse the repository at this point in the history
 * find-package-test fixed by passing CXX_FLAGS, i.e. -stdlib=libc++
 * std::array usage in compile-test.cc replaced with plain array, because
   <array> header was not included
  • Loading branch information
alexezeder authored and vitaut committed Apr 10, 2021
1 parent 1dbadb6 commit b441532
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ jobs:
build_type: Debug
std: 20
os: ubuntu-20.04
- cxx: clang++-11
build_type: Debug
std: 20
cxxflags: -stdlib=libc++
os: ubuntu-20.04
install: sudo apt install libc++-11-dev libc++abi-11-dev

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ if (FMT_PEDANTIC AND NOT WIN32)
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-options
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
"-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
"-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}"
"-DFMT_DIR=${PROJECT_BINARY_DIR}"
"-DPEDANTIC_COMPILE_FLAGS=${PEDANTIC_COMPILE_FLAGS}"
Expand Down
6 changes: 3 additions & 3 deletions test/compile-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,15 @@ TEST(CompileTest, CompileFormatStringLiteral) {
(__cplusplus >= 201709L && FMT_GCC_VERSION >= 1002)
template <size_t max_string_length, typename Char = char> struct test_string {
template <typename T> constexpr bool operator==(const T& rhs) const noexcept {
return fmt::basic_string_view<Char>(rhs).compare(buffer.data()) == 0;
return fmt::basic_string_view<Char>(rhs).compare(buffer) == 0;
}
std::array<Char, max_string_length> buffer{};
Char buffer[max_string_length]{};
};

template <size_t max_string_length, typename Char = char, typename... Args>
consteval auto test_format(auto format, const Args&... args) {
test_string<max_string_length, Char> string{};
fmt::format_to(string.buffer.data(), format, args...);
fmt::format_to(string.buffer, format, args...);
return string;
}

Expand Down

0 comments on commit b441532

Please sign in to comment.