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 // XFAIL: LIBCXX-AIX-FIXME 11 12 // <functional> 13 14 // template<CopyConstructible Fn, CopyConstructible... Types> 15 // unspecified bind(Fn, Types...); 16 // template<Returnable R, CopyConstructible Fn, CopyConstructible... Types> 17 // unspecified bind(Fn, Types...); 18 19 // https://llvm.org/PR16385 20 21 #include <functional> 22 #include <cmath> 23 #include <cassert> 24 25 #include "test_macros.h" 26 27 float _pow(float a, float b) 28 { 29 return std::pow(a, b); 30 } 31 32 int main(int, char**) 33 { 34 std::function<float(float, float)> fnc = _pow; 35 auto task = std::bind(fnc, 2.f, 4.f); 36 auto task2(task); 37 assert(task() == 16); 38 assert(task2() == 16); 39 40 return 0; 41 } 42