]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Fix accidental duplicate test [PR91456]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 21 Sep 2022 13:59:18 +0000 (14:59 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 21 Sep 2022 14:01:37 +0000 (15:01 +0100)
It looks like I committed the testcase for std::function twice, instead
of one for std::function and one for std::is_invocable_r. This replaces
the is_invocable_r one with the example from the PR.

libstdc++-v3/ChangeLog:

PR libstdc++/91456
* testsuite/20_util/function/91456.cc: Add comment with PR
number.
* testsuite/20_util/is_invocable/91456.cc: Likewise. Replace
std::function checks with std::is_invocable_r checks.

libstdc++-v3/testsuite/20_util/function/91456.cc
libstdc++-v3/testsuite/20_util/is_invocable/91456.cc

index 6b6631c452d229fb9c9016a1a034f0b78f1851b2..081bf20e2cfee63a24ed5fb4137ef7ae35f0d518 100644 (file)
@@ -17,6 +17,9 @@
 
 // { dg-do compile { target c++17 } }
 
+// PR 91456
+// std::function and std::is_invocable_r do not understand guaranteed elision
+
 #include <functional>
 
 struct Immovable {
index a946db15c553b1b32e1b79b0d7506b719c7b4863..976d257ce850adbbec3a9b86e3a56e16f080ba1a 100644 (file)
@@ -17,6 +17,9 @@
 
 // { dg-do compile { target c++17 } }
 
+// PR 91456
+// std::function and std::is_invocable_r do not understand guaranteed elision
+
 #include <type_traits>
 
 #include <functional>
@@ -27,7 +30,6 @@ struct Immovable {
   Immovable& operator=(const Immovable&) = delete;
 };
 
-Immovable get() { return {}; }
-const Immovable i = get();                      // OK
-std::function<const Immovable()> f{&get};       // fails
-const Immovable i2 = f();
+static_assert(std::is_invocable_r_v<Immovable, Immovable(*)()>);
+static_assert(std::is_invocable_r_v<const Immovable, Immovable(*)()>);
+static_assert(std::is_invocable_r_v<Immovable, const Immovable(*)()>);
This page took 0.065035 seconds and 5 git commands to generate.