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<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 #include "test_macros.h" 25 26 float _pow(float a, float b) 27 { 28 return std::pow(a, b); 29 } 30 31 int main(int, char**) 32 { 33 std::function<float(float, float)> fnc = _pow; 34 auto task = std::bind(fnc, 2.f, 4.f); 35 auto task2(task); 36 assert(task() == 16); 37 assert(task2() == 16); 38 39 return 0; 40 } 41