From 3d2bda6e6f9e5082c24203bf46ecdd0f24feddcc Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 31 Aug 2018 11:35:34 +0200 Subject: [PATCH] Work around ICC issue with __builtin_expect in constexpr function --- include/deal.II/base/utilities.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index 03ee0fbfbd..491796bd18 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -354,7 +354,19 @@ namespace Utilities pow(const unsigned int base, const int iexp) { #ifdef DEAL_II_WITH_CXX14 +# if defined(DEAL_II_HAVE_BUILTIN_EXPECT) && defined(__INTEL_COMPILER) + if (!(iexp >= 0)) + ::dealii::deal_II_exceptions::internals::issue_error_noreturn( + ::dealii::deal_II_exceptions::internals::abort_or_throw_on_exception, + __FILE__, + __LINE__, + __PRETTY_FUNCTION__, + "iexp>=0", + "ExcMessage(\"The exponent must not be negative!\")", + ExcMessage("The exponent must not be negative!")); +# else Assert(iexp >= 0, ExcMessage("The exponent must not be negative!")); +# endif #endif // The "exponentiation by squaring" algorithm used below has to be // compressed to one statement due to C++11's restrictions on constexpr -- 2.39.5