diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 45a370655c9ca..1dba3ddb5222b 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 @@ -535,7 +535,7 @@ constexpr auto compile(S format_str) { FMT_MODULE_EXPORT_BEGIN -#ifdef __cpp_if_constexpr +#if defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction) template 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 diff --git a/test/compile-test.cc b/test/compile-test.cc index 28eef2a246948..1765961b89fa6 100644 --- a/test/compile-test.cc +++ b/test/compile-test.cc @@ -76,7 +76,7 @@ TEST(compile_test, compile_type_with_get) { EXPECT_EQ("42", fmt::format(FMT_COMPILE("{}"), type_with_get())); } -#ifdef __cpp_if_constexpr +#if defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction) struct test_formattable {}; FMT_BEGIN_NAMESPACE