Skip to content

Commit 66632ba

Browse files
committed
Move pass to bind_back.verify.cpp and add better comment
Addresses #81055 (comment)
1 parent 17913b9 commit 66632ba

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

libcxx/test/std/utilities/function.objects/func.bind.partial/bind_back.verify.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717

1818
#include "types.h"
1919

20+
constexpr int pass(int n) { return n; }
21+
2022
void test() {
21-
{ // Various failures
22-
auto p = std::bind_back(pass, 1);
23-
static_assert(p() == 1); // expected-error {{static assertion expression is not an integral constant expression}}
23+
{ // Test calling constexpr function from non-constexpr `bind_back` unspecified-type
24+
auto f1 = std::bind_back(pass, 1);
25+
static_assert(f1() == 1); // expected-error {{static assertion expression is not an integral constant expression}}
26+
}
2427

28+
{ // Various failures
2529
auto d = std::bind_back(do_nothing, 2); // expected-error {{no matching function for call to 'bind_back'}}
2630
}
2731

libcxx/test/std/utilities/function.objects/func.bind.partial/types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ struct CopyMoveInfo {
3535
constexpr CopyMoveInfo(CopyMoveInfo&&) : copy_kind(move) {}
3636
};
3737

38-
constexpr int pass(int n) { return n; }
39-
4038
template <class T>
4139
T do_nothing(T t) {
4240
return t;

0 commit comments

Comments
 (0)