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 |
10 | |
11 | // <functional> |
12 | |
13 | // template<CopyConstructible Fn, CopyConstructible... Types> |
14 | // unspecified bind(Fn, Types...); // constexpr since C++20 |
15 | // template<Returnable R, CopyConstructible Fn, CopyConstructible... Types> |
16 | // unspecified bind(Fn, Types...); // constexpr since C++20 |
17 | |
18 | // https://llvm.org/PR23141 |
19 | #include <functional> |
20 | #include <type_traits> |
21 | |
22 | #include "test_macros.h" |
23 | |
24 | struct Fun { |
25 | template<typename T, typename U> |
26 | TEST_CONSTEXPR_CXX20 void operator()(T &&, U &&) const { |
27 | static_assert(std::is_same<U, int &>::value, "" ); |
28 | } |
29 | }; |
30 | |
31 | TEST_CONSTEXPR_CXX20 bool test() { |
32 | std::bind(f: Fun{}, args: std::placeholders::_1, args: 42)("hello" ); |
33 | return true; |
34 | } |
35 | |
36 | int main(int, char**) { |
37 | test(); |
38 | #if TEST_STD_VER >= 20 |
39 | static_assert(test()); |
40 | #endif |
41 | |
42 | return 0; |
43 | } |
44 | |