From: Timo Heister <timo.heister@gmail.com>
Date: Mon, 16 Sep 2019 13:25:29 +0000 (-0400)
Subject: improve check for CAN_CALL_NONCONSTEXPR
X-Git-Tag: v9.2.0-rc1~1086^2
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f45d01becc002b99a426f953fddb9e5bc59185a6;p=dealii.git

improve check for CAN_CALL_NONCONSTEXPR

On intel 19.0.5, the check
DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR passes but
compilation of an assert (and as such a throw call) fails.
Improve the test to catch this.
I can confirm that clang6 still passes this check as before.
fixes  #8758
---

diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake
index e94d944885..6eb67b2191 100644
--- a/cmake/checks/check_01_cxx_features.cmake
+++ b/cmake/checks/check_01_cxx_features.cmake
@@ -733,12 +733,14 @@ CHECK_CXX_SOURCE_COMPILES(
 #
 CHECK_CXX_SOURCE_COMPILES(
   "
+  #define Assert(x,y) if (!(x)) throw y;
   void bar()
   {}
 
   constexpr int
   foo(const int n)
   {
+    Assert(n>0, \"hello\");
     if(!(n >= 0))
       bar();
     return n;