On 9/23/25 1:49 PM, Jonathan Wakely wrote:
On Tue, 23 Sept 2025 at 12:11, Luc Grosheintz <luc.groshei...@gmail.com> wrote:

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 FMT to after including the header
<functional>.

This patch is certainly correct, but all tests that check feature test
macros should use:

// { dg-add-options no_pch }

This means they don't depend on whether PCH is enabled or not.


Would you like me to create version.cc instead? Then the rest of
the file keeps "running" even on builds with PCH (which seems
desirable to me).


libstdc++-v3/ChangeLog:

         * testsuite/20_util/function_objects/not_fn/nttp.cc: Move
         test for feature testing macro after #include.

Signed-off-by: Luc Grosheintz <luc.groshei...@gmail.com>
---
  .../testsuite/20_util/function_objects/not_fn/nttp.cc       | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

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..57d2c6ccf52 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,15 +2,15 @@

  // { dg-do run { target c++26 } }

+#include <functional>
+#include <testsuite_hooks.h>
+
  #ifndef __cpp_lib_not_fn
  # error "Feature test macro for not_fn is missing in <functional>"
  #elif __cpp_lib_not_fn < 202306L
  # error "Feature test macro for not_fn has wrong value in <functional>"
  #endif

-#include <functional>
-#include <testsuite_hooks.h>
-
  using std::not_fn;

  int func(int, char) { return 0; }
--
2.50.1



Reply via email to