1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++03, c++11, c++14, c++17 10 11 // functional 12 13 // template <class F, class... Args> 14 // constexpr unspecified bind_front(F&&, Args&&...); 15 16 #include <functional> 17 18 #include "test_macros.h" 19 20 constexpr int pass(const int n) { return n; } 21 22 int simple(int n) { return n; } 23 24 template<class T> 25 T do_nothing(T t) { return t; } 26 27 struct NotMoveConst 28 { 29 NotMoveConst(NotMoveConst &&) = delete; 30 NotMoveConst(NotMoveConst const&) = delete; 31 32 NotMoveConst(int) { } 33 }; 34 35 void testNotMoveConst(NotMoveConst) { } 36 37 int main(int, char**) 38 { 39 int n = 1; 40 const int c = 1; 41 42 auto p = std::bind_front(pass, c); 43 static_assert(p() == 1); // expected-error {{static_assert expression is not an integral constant expression}} 44 45 auto d = std::bind_front(do_nothing, n); // expected-error {{no matching function for call to 'bind_front'}} 46 47 auto t = std::bind_front(testNotMoveConst, NotMoveConst(0)); // expected-error {{no matching function for call to 'bind_front'}} 48 49 return 0; 50 } 51