From 41c95d5e53e66a97831e8c6ecdfca62e6f0dab4f Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Tue, 23 Sep 2025 14:34:41 +0200 Subject: [PATCH] libstdc++: Move test for __cpp_lib_not_fn to version.cc MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When running the tests without pre-compiled headers (--disable-libstdcxx-pch), the test fails, because the feature testing macro (FTM) isn't defined yet. This commit moves checking the FTM to a dedicated file (version.cc) that's run without PCH. libstdc++-v3/ChangeLog: * testsuite/20_util/function_objects/not_fn/nttp.cc: Move test of feature testing macro to version.cc * testsuite/20_util/function_objects/not_fn/version.cc: New test. Reviewed-by: Jonathan Wakely Co-authored-by: Tomasz Kamiński Signed-off-by: Luc Grosheintz Signed-off-by: Tomasz Kamiński --- .../20_util/function_objects/not_fn/nttp.cc | 6 ------ .../20_util/function_objects/not_fn/version.cc | 12 ++++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/function_objects/not_fn/version.cc diff --git a/libstdc++-v3/testsuite/20_util/function_objects/not_fn/nttp.cc b/libstdc++-v3/testsuite/20_util/function_objects/not_fn/nttp.cc index d35d828f14c..d24ccf8a187 100644 --- a/libstdc++-v3/testsuite/20_util/function_objects/not_fn/nttp.cc +++ b/libstdc++-v3/testsuite/20_util/function_objects/not_fn/nttp.cc @@ -2,12 +2,6 @@ // { dg-do run { target c++26 } } -#ifndef __cpp_lib_not_fn -# error "Feature test macro for not_fn is missing in " -#elif __cpp_lib_not_fn < 202306L -# error "Feature test macro for not_fn has wrong value in " -#endif - #include #include diff --git a/libstdc++-v3/testsuite/20_util/function_objects/not_fn/version.cc b/libstdc++-v3/testsuite/20_util/function_objects/not_fn/version.cc new file mode 100644 index 00000000000..fc8a3c9ed76 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function_objects/not_fn/version.cc @@ -0,0 +1,12 @@ +// { dg-do preprocess { target c++17 } } +// { dg-add-options no_pch } + +#include + +#ifndef __cpp_lib_not_fn +# error "Feature test macro for not_fn is missing in " +#elif __cpp_lib_not_fn < 201603L +# error "Feature test macro __cpp_lib_not_fn has the wrong value for C++17 or later" +#elif __cplusplus > 202302L && __cpp_lib_not_fn < 202306L +# error "Feature test macro __cpp_lib_not_fn has the wrong value for C++26 or later" +#endif -- 2.47.3