1*07a0b0eeSArthur O'Dwyer //===----------------------------------------------------------------------===//
2*07a0b0eeSArthur O'Dwyer //
3*07a0b0eeSArthur O'Dwyer // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*07a0b0eeSArthur O'Dwyer // See https://llvm.org/LICENSE.txt for license information.
5*07a0b0eeSArthur O'Dwyer // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*07a0b0eeSArthur O'Dwyer //
7*07a0b0eeSArthur O'Dwyer //===----------------------------------------------------------------------===//
8*07a0b0eeSArthur O'Dwyer 
9*07a0b0eeSArthur O'Dwyer // UNSUPPORTED: c++03, c++11
10*07a0b0eeSArthur O'Dwyer 
11*07a0b0eeSArthur O'Dwyer // <functional>
12*07a0b0eeSArthur O'Dwyer 
13*07a0b0eeSArthur O'Dwyer // template<class T> struct is_placeholder;
14*07a0b0eeSArthur O'Dwyer //   A program may specialize this template for a program-defined type T
15*07a0b0eeSArthur O'Dwyer //   to have a base characteristic of integral_constant<int, N> with N > 0
16*07a0b0eeSArthur O'Dwyer //   to indicate that T should be treated as a placeholder type.
17*07a0b0eeSArthur O'Dwyer //   https://llvm.org/PR51753
18*07a0b0eeSArthur O'Dwyer 
19*07a0b0eeSArthur O'Dwyer #include <functional>
20*07a0b0eeSArthur O'Dwyer #include <cassert>
21*07a0b0eeSArthur O'Dwyer #include <type_traits>
22*07a0b0eeSArthur O'Dwyer 
23*07a0b0eeSArthur O'Dwyer struct My2 {};
24*07a0b0eeSArthur O'Dwyer template<> struct std::is_placeholder<My2> : std::integral_constant<int, 2> {};
25*07a0b0eeSArthur O'Dwyer 
main(int,char **)26*07a0b0eeSArthur O'Dwyer int main(int, char**)
27*07a0b0eeSArthur O'Dwyer {
28*07a0b0eeSArthur O'Dwyer   {
29*07a0b0eeSArthur O'Dwyer     auto f = [](auto x) { return 10*x + 9; };
30*07a0b0eeSArthur O'Dwyer     My2 place;
31*07a0b0eeSArthur O'Dwyer     auto bound = std::bind(f, place);
32*07a0b0eeSArthur O'Dwyer     assert(bound(7, 8) == 89);
33*07a0b0eeSArthur O'Dwyer   }
34*07a0b0eeSArthur O'Dwyer   {
35*07a0b0eeSArthur O'Dwyer     auto f = [](auto x) { return 10*x + 9; };
36*07a0b0eeSArthur O'Dwyer     const My2 place;
37*07a0b0eeSArthur O'Dwyer     auto bound = std::bind(f, place);
38*07a0b0eeSArthur O'Dwyer     assert(bound(7, 8) == 89);
39*07a0b0eeSArthur O'Dwyer   }
40*07a0b0eeSArthur O'Dwyer   {
41*07a0b0eeSArthur O'Dwyer     auto f = [](auto x) { return 10*x + 9; };
42*07a0b0eeSArthur O'Dwyer     My2 place;
43*07a0b0eeSArthur O'Dwyer     auto bound = std::bind(f, std::move(place));
44*07a0b0eeSArthur O'Dwyer     assert(bound(7, 8) == 89);
45*07a0b0eeSArthur O'Dwyer   }
46*07a0b0eeSArthur O'Dwyer   {
47*07a0b0eeSArthur O'Dwyer     auto f = [](auto x) { return 10*x + 9; };
48*07a0b0eeSArthur O'Dwyer     const My2 place;
49*07a0b0eeSArthur O'Dwyer     auto bound = std::bind(f, std::move(place));
50*07a0b0eeSArthur O'Dwyer     assert(bound(7, 8) == 89);
51*07a0b0eeSArthur O'Dwyer   }
52*07a0b0eeSArthur O'Dwyer 
53*07a0b0eeSArthur O'Dwyer   return 0;
54*07a0b0eeSArthur O'Dwyer }
55