From b209c02fce68389055993f0e60cd9ba316dc9212 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 2 Mar 2023 03:26:09 -0700 Subject: [PATCH] Add a check for concepts to the C++20 test. --- cmake/checks/check_01_cxx_features.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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() { } -- 2.39.5