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<class T> struct is_bind_expression
14 
15 #include <functional>
16 #include "test_macros.h"
17 
18 template <bool Expected, class T>
19 void
test(const T &)20 test(const T&)
21 {
22     static_assert(std::is_bind_expression<T>::value == Expected, "");
23     LIBCPP_STATIC_ASSERT(std::is_bind_expression<T&>::value == Expected, "");
24     LIBCPP_STATIC_ASSERT(std::is_bind_expression<const T>::value == Expected, "");
25     LIBCPP_STATIC_ASSERT(std::is_bind_expression<const T&>::value == Expected, "");
26 
27 #if TEST_STD_VER > 14
28     static_assert(std::is_bind_expression_v<T> == Expected, "");
29     LIBCPP_STATIC_ASSERT(std::is_bind_expression_v<T&> == Expected, "");
30     LIBCPP_STATIC_ASSERT(std::is_bind_expression_v<const T> == Expected, "");
31     LIBCPP_STATIC_ASSERT(std::is_bind_expression_v<const T&> == Expected, "");
32 #endif
33 }
34 
operator ()C35 struct C {int operator()(...) const { return 0; }};
36 
main(int,char **)37 int main(int, char**)
38 {
39     test<true>(std::bind(C()));
40     test<true>(std::bind(C(), std::placeholders::_2));
41     test<true>(std::bind<int>(C()));
42     test<false>(1);
43     test<false>(std::placeholders::_2);
44 
45   return 0;
46 }
47