From a11eb3a0904381356f47c593b2c6254246cdd29d Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 22 Aug 2018 09:07:17 -0700 Subject: [PATCH] Workaround various icc bugs (#822) --- CMakeLists.txt | 2 +- include/fmt/printf.h | 4 +++- test/CMakeLists.txt | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e469a175..65d5f2e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,7 +92,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(WERROR_FLAG -Werror) endif () -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(PEDANTIC_COMPILE_FLAGS -Weverything -Wpedantic -Wno-weak-vtables -Wno-padded -Wno-gnu-statement-expression -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-reserved-id-macro diff --git a/include/fmt/printf.h b/include/fmt/printf.h index cbf08a49..3ed37b2b 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -337,7 +337,9 @@ struct printf_formatter { /** This template formats data and writes the output to a writer. */ template class basic_printf_context : - private internal::context_base< + // Inherit publicly as a workaround for the icc bug + // https://software.intel.com/en-us/forums/intel-c-compiler/topic/783476. + public internal::context_base< OutputIt, basic_printf_context, Char> { public: /** The character type for the output. */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 893cc4d2..3996ac4f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -123,7 +123,10 @@ else () endif () # Test that the library can be compiled with exceptions disabled. -check_cxx_compiler_flag(-fno-exceptions HAVE_FNO_EXCEPTIONS_FLAG) +# -fno-exception is broken in icc: https://github.com/fmtlib/fmt/issues/822. +if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + check_cxx_compiler_flag(-fno-exceptions HAVE_FNO_EXCEPTIONS_FLAG) +endif () if (HAVE_FNO_EXCEPTIONS_FLAG) add_library(noexception-test ../src/format.cc) target_include_directories(