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++98, c++03 10 11 // <functional> 12 13 // template<CopyConstructible Fn, CopyConstructible... Types> 14 // unspecified bind(Fn, Types...); 15 // template<Returnable R, CopyConstructible Fn, CopyConstructible... Types> 16 // unspecified bind(Fn, Types...); 17 18 // https://bugs.llvm.org/show_bug.cgi?id=16385 19 20 #include <functional> 21 #include <cmath> 22 #include <cassert> 23 24 float _pow(float a, float b) 25 { 26 return std::pow(a, b); 27 } 28 29 int main(int, char**) 30 { 31 std::function<float(float, float)> fnc = _pow; 32 auto task = std::bind(fnc, 2.f, 4.f); 33 auto task2(task); 34 assert(task() == 16); 35 assert(task2() == 16); 36 37 return 0; 38 } 39