From: Wolfgang Bangerth Date: Thu, 2 Mar 2023 10:26:09 +0000 (-0700) Subject: Add a check for concepts to the C++20 test. X-Git-Tag: v9.5.0-rc1~513^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b209c02fce68389055993f0e60cd9ba316dc9212;p=dealii.git Add a check for concepts to the C++20 test. --- diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index e7793e49b0..b6b9a0b28a 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -66,6 +66,8 @@ macro(_test_cxx20_support) # of the C++20 standard (which will have "202002L" when finalized). gcc-10 # exports this version number when configured with C++20 support. # clang-10 exports the final "202002L" version instead, as does gcc-11. + # + # Beyond this, check for some features we actually need. CHECK_CXX_SOURCE_COMPILES( " #include @@ -79,6 +81,20 @@ macro(_test_cxx20_support) # error \"insufficient support for C++20\" #endif + + // Test concepts and requires clauses + template + concept is_valid_dim_spacedim = (dim >= 1 && spacedim <= 3 && + dim <= spacedim); + + template + requires is_valid_dim_spacedim + class Triangulation + {}; + + Triangulation<1,3> t; + + int main() { }