]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Check for constexpr std::max with C++14. 6490/head
authorDavid Wells <wellsd2@rpi.edu>
Sun, 6 May 2018 02:46:51 +0000 (22:46 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Sun, 6 May 2018 02:46:51 +0000 (22:46 -0400)
cmake/checks/check_01_cxx_features.cmake

index 36e231d9705483c95f7a7ba1a8183f6096f4f5e4..ccc50ab2f3cadd8533131487a873f7816977b418 100644 (file)
@@ -169,16 +169,19 @@ IF(NOT DEFINED DEAL_II_WITH_CXX14 OR DEAL_II_WITH_CXX14)
     PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}")
 
     #
-    # This test does not guarantee full C++14 support, but virtually every
-    # compiler with some C++14 support implements this.
+    # We assume std::max has a constexpr version and make_unique works
     #
     CHECK_CXX_SOURCE_COMPILES(
       "
       #include <memory>
+      #include <cmath>
+
       int main()
       {
-          auto ptr = std::make_unique<int>(42);
-          return 0;
+        auto ptr = std::make_unique<int>(42);
+        constexpr int bob = std::max(sizeof(ptr), sizeof(char[8]));
+        int bobs[bob];
+        return 0;
       }
       "
       DEAL_II_HAVE_CXX14_MAKE_UNIQUE)

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.