[gcc r12-513] libstdc++: Add tests for std::invoke feature test macro

Jonathan Wakely redi@gcc.gnu.org
Wed May 5 12:01:00 GMT 2021


https://gcc.gnu.org/g:29745bf06276b9628d08ef1c9e28890cc56df4aa

commit r12-513-g29745bf06276b9628d08ef1c9e28890cc56df4aa
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed May 5 12:41:14 2021 +0100

    libstdc++: Add tests for std::invoke feature test macro
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/20_util/function_objects/invoke/3.cc: Check feature
            test macro.
            * testsuite/20_util/function_objects/invoke/version.cc: New test.

Diff:
---
 libstdc++-v3/testsuite/20_util/function_objects/invoke/3.cc      | 7 ++++++-
 .../testsuite/20_util/function_objects/invoke/version.cc         | 9 +++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/20_util/function_objects/invoke/3.cc b/libstdc++-v3/testsuite/20_util/function_objects/invoke/3.cc
index 5ffc5dedbab..40e068e86fd 100644
--- a/libstdc++-v3/testsuite/20_util/function_objects/invoke/3.cc
+++ b/libstdc++-v3/testsuite/20_util/function_objects/invoke/3.cc
@@ -15,11 +15,16 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=gnu++17" }
 // { dg-do compile { target c++17 } }
 
 #include <functional>
 
+#ifndef __cpp_lib_invoke
+# error Feature-test macro for invoke is missing in <functional>
+#elif __cpp_lib_invoke < 201411L
+# error Feature-test macro for invoke has the wrong value in <functional>
+#endif
+
 struct abstract {
   virtual ~abstract() = 0;
   void operator()() noexcept;
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/invoke/version.cc b/libstdc++-v3/testsuite/20_util/function_objects/invoke/version.cc
new file mode 100644
index 00000000000..cf1a46a1ada
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/function_objects/invoke/version.cc
@@ -0,0 +1,9 @@
+// { dg-do compile { target c++17 } }
+
+#include <version>
+
+#ifndef __cpp_lib_invoke
+# error Feature-test macro for invoke is missing in <version>
+#elif __cpp_lib_invoke < 201411L
+# error Feature-test macro for invoke has the wrong value in <version>
+#endif


More information about the Libstdc++-cvs mailing list