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> constexpr unspecified bind_front(F&&, Args&&...); 14 15 #include <functional> 16 17 #include "test_macros.h" 18 19 constexpr int pass(const int n) { return n; } 20 21 int simple(int n) { return n; } 22 23 template<class T> 24 T do_nothing(T t) { return t; } 25 26 struct NotMoveConst 27 { 28 NotMoveConst(NotMoveConst &&) = delete; 29 NotMoveConst(NotMoveConst const&) = delete; 30 31 NotMoveConst(int) { } 32 }; 33 34 void testNotMoveConst(NotMoveConst) { } 35 36 int main(int, char**) 37 { 38 int n = 1; 39 const int c = 1; 40 41 auto p = std::bind_front(pass, c); 42 static_assert(p() == 1); // expected-error {{static_assert expression is not an integral constant expression}} 43 44 auto d = std::bind_front(do_nothing, n); // expected-error {{no matching function for call to 'bind_front'}} 45 46 auto t = std::bind_front(testNotMoveConst, NotMoveConst(0)); // expected-error {{no matching function for call to 'bind_front'}} 47 48 return 0; 49 } 50