From 1ca8bca41414a6e2f235ea69b91378116a8e3afa Mon Sep 17 00:00:00 2001 From: Josh Essman Date: Wed, 13 Oct 2021 17:43:05 -0500 Subject: [PATCH 1/2] fix: check to make sure both 'if constexpr' and return type deduction are available fix: remaining ifdefs --- include/fmt/compile.h | 8 ++++---- test/compile-test.cc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 059262f95ef4..1dba3ddb5222 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -156,7 +156,7 @@ struct is_compiled_string : std::is_base_of {}; std::string s = fmt::format(FMT_COMPILE("{}"), 42); \endrst */ -#ifdef __cpp_if_constexpr +#if defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction) # define FMT_COMPILE(s) \ FMT_STRING_IMPL(s, fmt::detail::compiled_string, explicit) #else @@ -179,7 +179,7 @@ const T& first(const T& value, const Tail&...) { return value; } -#ifdef __cpp_if_constexpr +#if defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction) template struct type_list {}; // Returns a reference to the argument at index N from [first, rest...]. @@ -530,12 +530,12 @@ constexpr auto compile(S format_str) { return result; } } -#endif // __cpp_if_constexpr +#endif // defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction) } // namespace detail FMT_MODULE_EXPORT_BEGIN -#ifdef __cpp_if_constexpr +#if defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction) template Date: Thu, 14 Oct 2021 10:21:40 -0700 Subject: [PATCH 2/2] fix: add workaround for intel parameter pack bug --- include/fmt/os.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/fmt/os.h b/include/fmt/os.h index 297612fc8322..400e2c17b2fe 100644 --- a/include/fmt/os.h +++ b/include/fmt/os.h @@ -390,6 +390,13 @@ struct ostream_params { : ostream_params(params...) { this->buffer_size = bs.value; } + +// Intel has a bug that results in failure to deduce a constructor +// for empty parameter packs. +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 2000 + ostream_params(int new_oflag) : oflag(new_oflag) {} + ostream_params(detail::buffer_size bs) : buffer_size(bs.value) {} +#endif }; FMT_END_DETAIL_NAMESPACE