From 61a820796a076d14d67ff64d1394dd0e5ce8b267 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 22 Nov 2019 14:09:57 -0500 Subject: [PATCH] Disable DEAL_II_HAVE_CXX14_CONSTEXPR_CAN_CALL_NONCONSTEXPR for MSVC --- cmake/checks/check_01_cxx_features.cmake | 42 +++++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index 6eb67b2191..54d0bfa5b2 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -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. -- 2.39.5