107a0b0eeSArthur O'Dwyer //===----------------------------------------------------------------------===//
207a0b0eeSArthur O'Dwyer //
307a0b0eeSArthur O'Dwyer // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
407a0b0eeSArthur O'Dwyer // See https://llvm.org/LICENSE.txt for license information.
507a0b0eeSArthur O'Dwyer // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
607a0b0eeSArthur O'Dwyer //
707a0b0eeSArthur O'Dwyer //===----------------------------------------------------------------------===//
807a0b0eeSArthur O'Dwyer
907a0b0eeSArthur O'Dwyer // UNSUPPORTED: c++03, c++11
1007a0b0eeSArthur O'Dwyer
1107a0b0eeSArthur O'Dwyer // <functional>
1207a0b0eeSArthur O'Dwyer
1307a0b0eeSArthur O'Dwyer // template<class T> struct is_placeholder;
1407a0b0eeSArthur O'Dwyer // A program may specialize this template for a program-defined type T
1507a0b0eeSArthur O'Dwyer // to have a base characteristic of integral_constant<int, N> with N > 0
1607a0b0eeSArthur O'Dwyer // to indicate that T should be treated as a placeholder type.
1707a0b0eeSArthur O'Dwyer // https://llvm.org/PR51753
1807a0b0eeSArthur O'Dwyer
1907a0b0eeSArthur O'Dwyer #include <cassert>
20*7afa1598SNikolas Klauser #include <functional>
2107a0b0eeSArthur O'Dwyer #include <type_traits>
22*7afa1598SNikolas Klauser #include <utility>
2307a0b0eeSArthur O'Dwyer
2407a0b0eeSArthur O'Dwyer struct My2 {};
2507a0b0eeSArthur O'Dwyer template<> struct std::is_placeholder<My2> : std::integral_constant<int, 2> {};
2607a0b0eeSArthur O'Dwyer
main(int,char **)2707a0b0eeSArthur O'Dwyer int main(int, char**)
2807a0b0eeSArthur O'Dwyer {
2907a0b0eeSArthur O'Dwyer {
3007a0b0eeSArthur O'Dwyer auto f = [](auto x) { return 10*x + 9; };
3107a0b0eeSArthur O'Dwyer My2 place;
3207a0b0eeSArthur O'Dwyer auto bound = std::bind(f, place);
3307a0b0eeSArthur O'Dwyer assert(bound(7, 8) == 89);
3407a0b0eeSArthur O'Dwyer }
3507a0b0eeSArthur O'Dwyer {
3607a0b0eeSArthur O'Dwyer auto f = [](auto x) { return 10*x + 9; };
3707a0b0eeSArthur O'Dwyer const My2 place;
3807a0b0eeSArthur O'Dwyer auto bound = std::bind(f, place);
3907a0b0eeSArthur O'Dwyer assert(bound(7, 8) == 89);
4007a0b0eeSArthur O'Dwyer }
4107a0b0eeSArthur O'Dwyer {
4207a0b0eeSArthur O'Dwyer auto f = [](auto x) { return 10*x + 9; };
4307a0b0eeSArthur O'Dwyer My2 place;
4407a0b0eeSArthur O'Dwyer auto bound = std::bind(f, std::move(place));
4507a0b0eeSArthur O'Dwyer assert(bound(7, 8) == 89);
4607a0b0eeSArthur O'Dwyer }
4707a0b0eeSArthur O'Dwyer {
4807a0b0eeSArthur O'Dwyer auto f = [](auto x) { return 10*x + 9; };
4907a0b0eeSArthur O'Dwyer const My2 place;
5007a0b0eeSArthur O'Dwyer auto bound = std::bind(f, std::move(place));
5107a0b0eeSArthur O'Dwyer assert(bound(7, 8) == 89);
5207a0b0eeSArthur O'Dwyer }
5307a0b0eeSArthur O'Dwyer
5407a0b0eeSArthur O'Dwyer return 0;
5507a0b0eeSArthur O'Dwyer }
56