Skip to content

Commit

Permalink
Move pass to bind_back.verify.cpp and add better comment
Browse files Browse the repository at this point in the history
  • Loading branch information
JMazurkiewicz committed Mar 13, 2024
1 parent 17913b9 commit 66632ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@

#include "types.h"

constexpr int pass(int n) { return n; }

void test() {
{ // Various failures
auto p = std::bind_back(pass, 1);
static_assert(p() == 1); // expected-error {{static assertion expression is not an integral constant expression}}
{ // Test calling constexpr function from non-constexpr `bind_back` unspecified-type
auto f1 = std::bind_back(pass, 1);
static_assert(f1() == 1); // expected-error {{static assertion expression is not an integral constant expression}}
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ struct CopyMoveInfo {
constexpr CopyMoveInfo(CopyMoveInfo&&) : copy_kind(move) {}
};

constexpr int pass(int n) { return n; }

template <class T>
T do_nothing(T t) {
return t;
Expand Down

0 comments on commit 66632ba

Please sign in to comment.