]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Require support for attribute [[assume]] for C++23 support 16582/head
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 1 Feb 2024 14:35:11 +0000 (09:35 -0500)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 1 Feb 2024 14:35:25 +0000 (09:35 -0500)
cmake/checks/check_01_cxx_features.cmake

index 509f11e2acacb8c36de3d776bd3722cd0f0ca81c..22791a41ee2a12d2f0b7856355db907e2aae2117 100644 (file)
@@ -63,6 +63,7 @@ macro(_test_cxx23_support)
   # Strictly speaking "202100L" indicates support for a preliminary version
   # of the C++23 standard (which will have "202302L" when finalized). gcc-13
   # exports this version number when configured with C++23 support.
+  add_flags(CMAKE_REQUIRED_FLAGS "-Werror")
   CHECK_CXX_SOURCE_COMPILES(
     "
     #include <version>
@@ -75,9 +76,12 @@ macro(_test_cxx23_support)
       static void operator()() {}
     };
 
-    int main() {}
+    int main() {
+      [[assume(2 > 1)]];
+    }
     "
     DEAL_II_HAVE_CXX23_FEATURES)
+  reset_cmake_required()
 
   if(DEAL_II_HAVE_CXX23_FEATURES)
     message(STATUS "C++23 support is enabled.")

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.