From: Daniel Arndt Date: Fri, 31 Aug 2018 09:35:34 +0000 (+0200) Subject: Work around ICC issue with __builtin_expect in constexpr function X-Git-Tag: v9.1.0-rc1~750^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d2bda6e6f9e5082c24203bf46ecdd0f24feddcc;p=dealii.git Work around ICC issue with __builtin_expect in constexpr function --- 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