]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Disable DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR for MSVC
authorDaniel Arndt <arndtd@ornl.gov>
Fri, 22 Nov 2019 19:09:57 +0000 (14:09 -0500)
committerDaniel Arndt <arndtd@ornl.gov>
Fri, 22 Nov 2019 19:27:18 +0000 (14:27 -0500)
cmake/checks/check_01_cxx_features.cmake

index 6eb67b2191d9851199130384fbe0e585ec2741c7..54d0bfa5b2a1a1737504c96e7fa956e3cdf8dbc6 100644 (file)
@@ -731,28 +731,30 @@ CHECK_CXX_SOURCE_COMPILES(
 # expression, C++14 allows to call non-constexpr functions from constexpr
 # functions. Unfortunately, not all compilers obey the standard in this regard.
 #
-CHECK_CXX_SOURCE_COMPILES(
-  "
-  #define Assert(x,y) if (!(x)) throw y;
-  void bar()
-  {}
+IF(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+  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;
-  }
+    constexpr int
+    foo(const int n)
+    {
+      Assert(n>0, \"hello\");
+      if(!(n >= 0))
+        bar();
+      return n;
+    }
 
-  int main()
-  {
-    constexpr unsigned int n=foo(1);
-    return n;
-  }
-  "
-  DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR)
+    int main()
+    {
+      constexpr unsigned int n=foo(1);
+      return n;
+    }
+    "
+    DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR)
+ENDIF()
 
 #
 # The macro DEAL_II_CONSTEXPR allows using c++ constexpr features in a portable way.

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.