diff options
author | Howard Hinnant <hhinnant@apple.com> | 2011-05-19 19:41:47 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2011-05-19 19:41:47 +0000 |
commit | 2344d6c195a4bbfb10c65ccb1f924b19c69b4132 (patch) | |
tree | 67cc678d81e144d4878e5605a07e80423a143c8c /libcxx/test/utilities/function.objects/bind | |
parent | 7e6e8951afd3c0adfb4f578186d9ea24a765b851 (diff) | |
download | bcm5719-llvm-2344d6c195a4bbfb10c65ccb1f924b19c69b4132.tar.gz bcm5719-llvm-2344d6c195a4bbfb10c65ccb1f924b19c69b4132.zip |
Simplied bind using __invoke. In the process, found and fixed a couple of bugs. C++11 only.
llvm-svn: 131667
Diffstat (limited to 'libcxx/test/utilities/function.objects/bind')
2 files changed, 19 insertions, 0 deletions
diff --git a/libcxx/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp b/libcxx/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp index 7417db32e39..6b18fa295bc 100644 --- a/libcxx/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp +++ b/libcxx/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp @@ -264,4 +264,5 @@ int main() { test_void_1(); test_int_1(); + test_void_2(); } diff --git a/libcxx/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp b/libcxx/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp index 9bde151cdfb..4913a510c36 100644 --- a/libcxx/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp +++ b/libcxx/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp @@ -241,8 +241,26 @@ test_void_2() } } +int f_nested(int i) +{ + return i+1; +} + +int g_nested(int i) +{ + return i*10; +} + +void test_nested() +{ + using namespace std::placeholders; + assert(std::bind(f_nested, std::bind(g_nested, _1))(3) == 31); +} + int main() { test_void_1(); test_int_1(); + test_void_2(); + test_nested(); } |