Actually, if we're going to add a separate not_fn/version.cc file,
let's do it right.
It should be { target c++20 } and should check that __cpp_lib_not_fn
is not less than 201603L for C++20/23 and not less than 202306L for
C++26.
On Wed, 24 Sept 2025 at 12:31, Jonathan Wakely <[email protected]> wrote:
>
> On Tue, 23 Sept 2025 at 13:35, Luc Grosheintz <[email protected]>
> 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 a dedicated file (version.cc)
>
> "FMT" -> "FTM"
>
> OK with that change.
>
> > 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.
> >
> > Signed-off-by: Luc Grosheintz <[email protected]>
> > ---
> > .../testsuite/20_util/function_objects/not_fn/nttp.cc | 6 ------
> > .../20_util/function_objects/not_fn/version.cc | 10 ++++++++++
> > 2 files changed, 10 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 <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>
> >
> > 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..9a6343b9c43
> > --- /dev/null
> > +++ b/libstdc++-v3/testsuite/20_util/function_objects/not_fn/version.cc
> > @@ -0,0 +1,10 @@
> > +// { dg-do preprocess { target c++26 } }
> > +// { dg-add-options no_pch }
> > +
> > +#include <functional>
> > +
> > +#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
> > --
> > 2.50.1
> >