From b44153239666fc79990a179b699cad5f7135540c Mon Sep 17 00:00:00 2001 From: Alexey Ochapov Date: Thu, 8 Apr 2021 03:25:40 +0300 Subject: [PATCH] CI linux: add clang++-11 C++20 (with LLVM libc++) build * find-package-test fixed by passing CXX_FLAGS, i.e. -stdlib=libc++ * std::array usage in compile-test.cc replaced with plain array, because header was not included --- .github/workflows/linux.yml | 6 ++++++ test/CMakeLists.txt | 1 + test/compile-test.cc | 6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 6e989198..200c8bb0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -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 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c50bb398..6ab80dee 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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}" diff --git a/test/compile-test.cc b/test/compile-test.cc index c3d31ac6..b0ea8fa2 100644 --- a/test/compile-test.cc +++ b/test/compile-test.cc @@ -323,15 +323,15 @@ TEST(CompileTest, CompileFormatStringLiteral) { (__cplusplus >= 201709L && FMT_GCC_VERSION >= 1002) template struct test_string { template constexpr bool operator==(const T& rhs) const noexcept { - return fmt::basic_string_view(rhs).compare(buffer.data()) == 0; + return fmt::basic_string_view(rhs).compare(buffer) == 0; } - std::array buffer{}; + Char buffer[max_string_length]{}; }; template consteval auto test_format(auto format, const Args&... args) { test_string string{}; - fmt::format_to(string.buffer.data(), format, args...); + fmt::format_to(string.buffer, format, args...); return string; }