184a50f59Szoecarver //===----------------------------------------------------------------------===//
284a50f59Szoecarver //
384a50f59Szoecarver // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
484a50f59Szoecarver // See https://llvm.org/LICENSE.txt for license information.
584a50f59Szoecarver // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
684a50f59Szoecarver //
784a50f59Szoecarver //===----------------------------------------------------------------------===//
884a50f59Szoecarver
9e35677c0SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14, c++17
1084a50f59Szoecarver
1184a50f59Szoecarver // functional
1284a50f59Szoecarver
13f599e7a7SLouis Dionne // template <class F, class... Args>
14f599e7a7SLouis Dionne // constexpr unspecified bind_front(F&&, Args&&...);
1584a50f59Szoecarver
1684a50f59Szoecarver #include <functional>
1784a50f59Szoecarver
1884a50f59Szoecarver #include "test_macros.h"
1984a50f59Szoecarver
pass(const int n)2084a50f59Szoecarver constexpr int pass(const int n) { return n; }
2184a50f59Szoecarver
simple(int n)2284a50f59Szoecarver int simple(int n) { return n; }
2384a50f59Szoecarver
2484a50f59Szoecarver template<class T>
do_nothing(T t)2584a50f59Szoecarver T do_nothing(T t) { return t; }
2684a50f59Szoecarver
2784a50f59Szoecarver struct NotMoveConst
2884a50f59Szoecarver {
2984a50f59Szoecarver NotMoveConst(NotMoveConst &&) = delete;
3084a50f59Szoecarver NotMoveConst(NotMoveConst const&) = delete;
3184a50f59Szoecarver
NotMoveConstNotMoveConst3284a50f59Szoecarver NotMoveConst(int) { }
3384a50f59Szoecarver };
3484a50f59Szoecarver
testNotMoveConst(NotMoveConst)3584a50f59Szoecarver void testNotMoveConst(NotMoveConst) { }
3684a50f59Szoecarver
main(int,char **)3784a50f59Szoecarver int main(int, char**)
3884a50f59Szoecarver {
3984a50f59Szoecarver int n = 1;
4084a50f59Szoecarver const int c = 1;
4184a50f59Szoecarver
4284a50f59Szoecarver auto p = std::bind_front(pass, c);
43*76476efdSMuhammad Usman Shahid static_assert(p() == 1); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
4484a50f59Szoecarver
4584a50f59Szoecarver auto d = std::bind_front(do_nothing, n); // expected-error {{no matching function for call to 'bind_front'}}
4684a50f59Szoecarver
4784a50f59Szoecarver auto t = std::bind_front(testNotMoveConst, NotMoveConst(0)); // expected-error {{no matching function for call to 'bind_front'}}
4884a50f59Szoecarver
4984a50f59Szoecarver return 0;
5084a50f59Szoecarver }
51