From 8131d4f094735e0a3c0ec9132edf6f5cd88cd142 Mon Sep 17 00:00:00 2001 From: Alexey Ochapov Date: Fri, 25 Dec 2020 02:37:22 +0300 Subject: [PATCH] fix macro check for formatting at compile-time on GCC 10.2+ --- include/fmt/format.h | 3 ++- test/compile-test.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index a57f7b65..ec1a7ae1 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -282,7 +282,8 @@ FMT_END_NAMESPACE FMT_BEGIN_NAMESPACE namespace detail { -#if __cplusplus >= 202002L || FMT_GCC_VERSION >= 1002 +#if __cplusplus >= 202002L || \ + (__cplusplus >= 201709L && FMT_GCC_VERSION >= 1002) # define FMT_CONSTEXPR20 constexpr #else # define FMT_CONSTEXPR20 inline diff --git a/test/compile-test.cc b/test/compile-test.cc index 5dba5019..c2e1ec1c 100644 --- a/test/compile-test.cc +++ b/test/compile-test.cc @@ -184,7 +184,8 @@ TEST(CompileTest, CompileFormatStringLiteral) { } #endif -#if __cplusplus >= 202002L || FMT_GCC_VERSION >= 1002 +#if __cplusplus >= 202002L || \ + (__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;