summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/thread/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/thread/test/functional')
-rw-r--r--src/boost/libs/thread/test/functional/invoke/invoke_int_0_pass.cpp68
-rw-r--r--src/boost/libs/thread/test/functional/invoke/invoke_lvalue_pass.cpp336
-rw-r--r--src/boost/libs/thread/test/functional/invoke/invoke_rvalue_pass.cpp227
-rw-r--r--src/boost/libs/thread/test/functional/invoker/invoker_int_0_pass.cpp68
-rw-r--r--src/boost/libs/thread/test/functional/invoker/invoker_lvalue_pass.cpp342
-rw-r--r--src/boost/libs/thread/test/functional/invoker/invoker_rvalue_pass.cpp230
6 files changed, 1271 insertions, 0 deletions
diff --git a/src/boost/libs/thread/test/functional/invoke/invoke_int_0_pass.cpp b/src/boost/libs/thread/test/functional/invoke/invoke_int_0_pass.cpp
new file mode 100644
index 00000000..fa1f6754
--- /dev/null
+++ b/src/boost/libs/thread/test/functional/invoke/invoke_int_0_pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Copyright (C) 2014 Vicente J. Botet Escriba
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// <boost/thread/detail/invoke.hpp>
+
+#include <boost/thread/detail/invoke.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int f()
+{
+ return 1;
+}
+
+struct A_int_0
+{
+ A_int_0()
+ {
+ }
+ int operator()()
+ {
+ return 4;
+ }
+ int operator()() const
+ {
+ return 5;
+ }
+};
+
+
+int main()
+{
+ const A_int_0 ca;
+ A_int_0 a;
+
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST_EQ(boost::detail::invoke(f), 1);
+ BOOST_TEST_EQ(boost::detail::invoke(&f), 1);
+ BOOST_TEST_EQ(boost::detail::invoke(A_int_0()), 4);
+ BOOST_TEST_EQ(boost::detail::invoke(a), 4);
+ BOOST_TEST_EQ(boost::detail::invoke(ca), 5);
+#endif
+
+ BOOST_TEST_EQ(boost::detail::invoke<int>(f), 1);
+ BOOST_TEST_EQ(boost::detail::invoke<int>(&f), 1);
+ BOOST_TEST_EQ(A_int_0()(), 4);
+#if defined BOOST_THREAD_PROVIDES_INVOKE || ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ BOOST_TEST_EQ(boost::detail::invoke<int>(A_int_0()), 4);
+#else
+ //BOOST_TEST_EQ(boost::detail::invoke<int>(A_int_0()), 5);
+#endif
+ BOOST_TEST_EQ(a(), 4);
+ BOOST_TEST_EQ(boost::detail::invoke<int>(a), 4);
+ BOOST_TEST_EQ(ca(), 5);
+ BOOST_TEST_EQ(boost::detail::invoke<int>(ca), 5);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/thread/test/functional/invoke/invoke_lvalue_pass.cpp b/src/boost/libs/thread/test/functional/invoke/invoke_lvalue_pass.cpp
new file mode 100644
index 00000000..154953d8
--- /dev/null
+++ b/src/boost/libs/thread/test/functional/invoke/invoke_lvalue_pass.cpp
@@ -0,0 +1,336 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Copyright (C) 2014 Vicente J. Botet Escriba
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+// <boost/thread/detail/invoke.hpp>
+
+#include <boost/thread/detail/invoke.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int count = 0;
+
+// 1 arg, return void
+
+void f_void_1(int i)
+{
+ count += i;
+}
+
+struct A_void_1
+{
+ void operator()(int i)
+ {
+ count += i;
+ }
+
+ void mem1() {++count;}
+ void mem2() const {count += 2;}
+};
+
+void
+test_void_1()
+{
+ int save_count = count;
+ // function
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ int i = 2;
+ boost::detail::invoke(f_void_1, i);
+ BOOST_TEST(count == save_count + 2);
+ save_count = count;
+ }
+#endif
+ {
+ int i = 2;
+ boost::detail::invoke<void>(f_void_1, i);
+ BOOST_TEST(count == save_count + 2);
+ save_count = count;
+ }
+ // function pointer
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ void (*fp)(int) = f_void_1;
+ int i = 3;
+ boost::detail::invoke(fp, i);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+ }
+#endif
+ {
+ void (*fp)(int) = f_void_1;
+ int i = 3;
+ boost::detail::invoke<void>(fp, i);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+ }
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ void (*fp)(int) = f_void_1;
+ int i = 3;
+ boost::detail::invoke(fp, i);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+ }
+#endif
+ {
+ void (*fp)(int) = f_void_1;
+ int i = 3;
+ boost::detail::invoke<void>(fp, i);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+ }
+ // functor
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ A_void_1 a0;
+ int i = 4;
+ boost::detail::invoke(a0, i);
+ BOOST_TEST(count == save_count+4);
+ save_count = count;
+ }
+#endif
+ {
+ A_void_1 a0;
+ int i = 4;
+ boost::detail::invoke<void>(a0, i);
+ BOOST_TEST(count == save_count+4);
+ save_count = count;
+ }
+ // member function pointer
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ void (A_void_1::*fp)() = &A_void_1::mem1;
+ A_void_1 a;
+ boost::detail::invoke(fp, a);
+ BOOST_TEST(count == save_count+1);
+ save_count = count;
+ A_void_1* ap = &a;
+ boost::detail::invoke(fp, ap);
+ BOOST_TEST(count == save_count+1);
+ save_count = count;
+ }
+#endif
+ {
+ void (A_void_1::*fp)() = &A_void_1::mem1;
+ A_void_1 a;
+ boost::detail::invoke<void>(fp, a);
+ BOOST_TEST(count == save_count+1);
+ save_count = count;
+ A_void_1* ap = &a;
+ boost::detail::invoke<void>(fp, ap);
+ BOOST_TEST(count == save_count+1);
+ save_count = count;
+ }
+ // const member function pointer
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ void (A_void_1::*fp)() const = &A_void_1::mem2;
+ A_void_1 a;
+ boost::detail::invoke(fp, a);
+ BOOST_TEST(count == save_count+2);
+ save_count = count;
+ A_void_1* ap = &a;
+ boost::detail::invoke(fp, ap);
+ BOOST_TEST(count == save_count+2);
+ save_count = count;
+ }
+#endif
+ {
+ void (A_void_1::*fp)() const = &A_void_1::mem2;
+ A_void_1 a;
+ boost::detail::invoke<void>(fp, a);
+ BOOST_TEST(count == save_count+2);
+ save_count = count;
+ A_void_1* ap = &a;
+ boost::detail::invoke<void>(fp, ap);
+ BOOST_TEST(count == save_count+2);
+ save_count = count;
+ }
+}
+
+// 1 arg, return int
+
+int f_int_1(int i)
+{
+ return i + 1;
+}
+
+struct A_int_1
+{
+ A_int_1() : data_(5) {}
+ int operator()(int i)
+ {
+ return i - 1;
+ }
+
+ int mem1() {return 3;}
+ int mem2() const {return 4;}
+ int data_;
+};
+
+void
+test_int_1()
+{
+ // function
+ {
+ int i = 2;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(f_int_1, i) == 3);
+#endif
+ BOOST_TEST(boost::detail::invoke<int>(f_int_1, i) == 3);
+ }
+ // function pointer
+ {
+ int (*fp)(int) = f_int_1;
+ int i = 3;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(fp, i) == 4);
+#endif
+ BOOST_TEST(boost::detail::invoke<int>(fp, i) == 4);
+ }
+ // functor
+ {
+ int i = 4;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(A_int_1(), i) == 3);
+#endif
+ const A_int_1 ca;
+ A_int_1 a;
+ BOOST_TEST(boost::detail::invoke<int>(a, i) == 3);
+ //BOOST_TEST(boost::detail::invoke<int>(ca, i) == 3);
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke<int>(A_int_1(), i) == 3);
+#endif
+ }
+ // member function pointer
+ {
+ A_int_1 a;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(&A_int_1::mem1, a) == 3);
+#endif
+ BOOST_TEST(boost::detail::invoke<int>(&A_int_1::mem1, a) == 3);
+ A_int_1* ap = &a;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(&A_int_1::mem1, ap) == 3);
+#endif
+ BOOST_TEST(boost::detail::invoke<int>(&A_int_1::mem1, ap) == 3);
+ }
+ // const member function pointer
+ {
+ A_int_1 a;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(&A_int_1::mem2, A_int_1()) == 4);
+#endif
+ BOOST_TEST(boost::detail::invoke<int>(&A_int_1::mem2, A_int_1()) == 4);
+ A_int_1* ap = &a;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(&A_int_1::mem2, ap) == 4);
+#endif
+ BOOST_TEST(boost::detail::invoke<int>(&A_int_1::mem2, ap) == 4);
+ }
+ // member data pointer
+ {
+ A_int_1 a;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(&A_int_1::data_, a) == 5);
+
+ BOOST_TEST(boost::detail::invoke<int>(&A_int_1::data_, a) == 5);
+
+#endif
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ A_int_1* ap = &a;
+
+ boost::detail::invoke(&A_int_1::data_, a) = 6;
+ BOOST_TEST(boost::detail::invoke(&A_int_1::data_, a) == 6);
+
+ boost::detail::invoke<int>(&A_int_1::data_, a) = 6;
+ BOOST_TEST(boost::detail::invoke<int>(&A_int_1::data_, a) == 6);
+
+#endif
+
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(&A_int_1::data_, ap) == 6);
+ boost::detail::invoke(&A_int_1::data_, ap) = 7;
+ BOOST_TEST(boost::detail::invoke(&A_int_1::data_, ap) == 7);
+
+ BOOST_TEST(boost::detail::invoke<int>(&A_int_1::data_, ap) == 7);
+ boost::detail::invoke<int>(&A_int_1::data_, ap) = 8;
+ BOOST_TEST(boost::detail::invoke<int>(&A_int_1::data_, ap) == 8);
+#endif
+
+ }
+}
+
+// 2 arg, return void
+
+void f_void_2(int i, int j)
+{
+ count += i+j;
+}
+
+struct A_void_2
+{
+ void operator()(int i, int j)
+ {
+ count += i+j;
+ }
+
+ void mem1(int i) {count += i;}
+ void mem2(int i) const {count += i;}
+};
+
+void
+test_void_2()
+{
+ int save_count = count;
+ // function
+ {
+ int i = 2;
+ int j = 3;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ boost::detail::invoke(f_void_2, i, j);
+ BOOST_TEST(count == save_count+5);
+ save_count = count;
+#endif
+ boost::detail::invoke<void>(f_void_2, i, j);
+ BOOST_TEST(count == save_count+5);
+ save_count = count;
+ }
+ // member function pointer
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ int j = 3;
+ boost::detail::invoke(&A_void_2::mem1, A_void_2(), j);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+
+ boost::detail::invoke<void>(&A_void_2::mem1, A_void_2(), j);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+#endif
+// A_void_2 a2;
+// boost::detail::invoke<void>(&A_void_2::mem1, a2, j);
+// BOOST_TEST(count == save_count+3);
+// save_count = count;
+ }
+}
+
+int main()
+{
+ test_void_1();
+ test_int_1();
+ test_void_2();
+ return boost::report_errors();
+
+}
diff --git a/src/boost/libs/thread/test/functional/invoke/invoke_rvalue_pass.cpp b/src/boost/libs/thread/test/functional/invoke/invoke_rvalue_pass.cpp
new file mode 100644
index 00000000..82ea0943
--- /dev/null
+++ b/src/boost/libs/thread/test/functional/invoke/invoke_rvalue_pass.cpp
@@ -0,0 +1,227 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Copyright (C) 2014 Vicente J. Botet Escriba
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// <boost/thread/detail/invoke.hpp>
+
+#include <boost/thread/detail/invoke.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int count = 0;
+
+// 1 arg, return void
+
+void f_void_1(int i)
+{
+ count += i;
+}
+
+struct A_void_1
+{
+ void operator()(int i)
+ {
+ count += i;
+ }
+
+ void mem1() {++count;}
+ void mem2() const {count += 2;}
+};
+
+void
+test_void_1()
+{
+ int save_count = count;
+ // function
+ {
+ boost::detail::invoke(f_void_1, 2);
+ BOOST_TEST(count == save_count + 2);
+ save_count = count;
+ }
+ // function pointer
+ {
+ void (*fp)(int) = f_void_1;
+ boost::detail::invoke(fp, 3);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+ }
+ // functor
+ {
+ A_void_1 a0;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ boost::detail::invoke(a0, 4);
+ BOOST_TEST(count == save_count+4);
+ save_count = count;
+#endif
+ boost::detail::invoke<void>(a0, 4);
+ BOOST_TEST(count == save_count+4);
+ save_count = count;
+ }
+ // member function pointer
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ void (A_void_1::*fp)() = &A_void_1::mem1;
+ boost::detail::invoke(fp, A_void_1());
+ BOOST_TEST(count == save_count+1);
+ save_count = count;
+ //BUG
+ boost::detail::invoke<void>(fp, A_void_1());
+ BOOST_TEST(count == save_count+1);
+ save_count = count;
+
+#endif
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ A_void_1 a;
+ boost::detail::invoke(fp, &a);
+ BOOST_TEST(count == save_count+1);
+ save_count = count;
+ //BUG
+ boost::detail::invoke<int>(fp, &a);
+ BOOST_TEST(count == save_count+1);
+ save_count = count;
+
+#endif
+ }
+ // const member function pointer
+ {
+ void (A_void_1::*fp)() const = &A_void_1::mem2;
+ boost::detail::invoke(fp, A_void_1());
+ BOOST_TEST(count == save_count+2);
+ save_count = count;
+ A_void_1 a;
+ boost::detail::invoke(fp, &a);
+ BOOST_TEST(count == save_count+2);
+ save_count = count;
+ }
+}
+
+// 1 arg, return int
+
+int f_int_1(int i)
+{
+ return i + 1;
+}
+
+struct A_int_1
+{
+ A_int_1() : data_(5) {}
+ int operator()(int i)
+ {
+ return i - 1;
+ }
+
+ int mem1() {return 3;}
+ int mem2() const {return 4;}
+ int data_;
+};
+
+void
+test_int_1()
+{
+ // function
+ {
+ BOOST_TEST(boost::detail::invoke(f_int_1, 2) == 3);
+ }
+ // function pointer
+ {
+ int (*fp)(int) = f_int_1;
+ BOOST_TEST(boost::detail::invoke(fp, 3) == 4);
+ }
+ // functor
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(A_int_1(), 4) == 3);
+ BOOST_TEST(boost::detail::invoke<int>(A_int_1(), 4) == 3);
+#endif
+ }
+ // member function pointer
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(&A_int_1::mem1, A_int_1()) == 3);
+ BOOST_TEST(boost::detail::invoke<int>(&A_int_1::mem1, A_int_1()) == 3);
+#endif
+
+ A_int_1 a;
+ BOOST_TEST(boost::detail::invoke(&A_int_1::mem1, &a) == 3);
+ }
+ // const member function pointer
+ {
+ BOOST_TEST(boost::detail::invoke(&A_int_1::mem2, A_int_1()) == 4);
+ A_int_1 a;
+ BOOST_TEST(boost::detail::invoke(&A_int_1::mem2, &a) == 4);
+ }
+ // member data pointer
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST(boost::detail::invoke(&A_int_1::data_, A_int_1()) == 5);
+ BOOST_TEST(boost::detail::invoke<int>(&A_int_1::data_, A_int_1()) == 5);
+ A_int_1 a;
+ BOOST_TEST(boost::detail::invoke(&A_int_1::data_, a) == 5);
+ boost::detail::invoke(&A_int_1::data_, a) = 6;
+ BOOST_TEST(boost::detail::invoke(&A_int_1::data_, a) == 6);
+ BOOST_TEST(boost::detail::invoke(&A_int_1::data_, &a) == 6);
+ boost::detail::invoke(&A_int_1::data_, &a) = 7;
+ BOOST_TEST(boost::detail::invoke(&A_int_1::data_, &a) == 7);
+#endif
+ }
+}
+
+// 2 arg, return void
+
+void f_void_2(int i, int j)
+{
+ count += i+j;
+}
+
+struct A_void_2
+{
+ void operator()(int i, int j)
+ {
+ count += i+j;
+ }
+
+ void mem1(int i) {count += i;}
+ void mem2(int i) const {count += i;}
+};
+
+void
+test_void_2()
+{
+ int save_count = count;
+ // function
+ {
+ boost::detail::invoke(f_void_2, 2, 3);
+ BOOST_TEST(count == save_count+5);
+ save_count = count;
+ }
+ // member function pointer
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ boost::detail::invoke(&A_void_2::mem1, A_void_2(), 3);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+
+ boost::detail::invoke<void>(&A_void_2::mem1, A_void_2(), 3);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+#endif
+
+ }
+}
+
+int main()
+{
+ test_void_1();
+ test_int_1();
+ test_void_2();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/thread/test/functional/invoker/invoker_int_0_pass.cpp b/src/boost/libs/thread/test/functional/invoker/invoker_int_0_pass.cpp
new file mode 100644
index 00000000..123bde2e
--- /dev/null
+++ b/src/boost/libs/thread/test/functional/invoker/invoker_int_0_pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Copyright (C) 2014 Vicente J. Botet Escriba
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// <boost/thread/detail/invoker.hpp>
+
+#include <boost/thread/detail/invoker.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int f()
+{
+ return 1;
+}
+
+struct A_int_0
+{
+ A_int_0()
+ {
+ }
+ int operator()()
+ {
+ return 4;
+ }
+ int operator()() const
+ {
+ return 5;
+ }
+};
+
+
+int main()
+{
+ const A_int_0 ca;
+ A_int_0 a;
+
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST_EQ(boost::detail::invoker<int(*)()>(f)(), 1);
+ BOOST_TEST_EQ(boost::detail::invoker<int(*)()>(&f)(), 1);
+ BOOST_TEST_EQ(boost::detail::invoker<A_int_0>(A_int_0())(), 4);
+ BOOST_TEST_EQ(boost::detail::invoker<A_int_0>(a)(), 4);
+ BOOST_TEST_EQ(boost::detail::invoker<const A_int_0>(ca)(), 5);
+#endif
+
+ //BOOST_TEST_EQ(boost::detail::invoker<int>(f), 1);
+ //BOOST_TEST_EQ(boost::detail::invoker<int>(&f), 1);
+ BOOST_TEST_EQ(A_int_0()(), 4);
+#if defined BOOST_THREAD_PROVIDES_INVOKE || ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ //BOOST_TEST_EQ(boost::detail::invoker<int>(A_int_0()), 4);
+#else
+ //BOOST_TEST_EQ(boost::detail::invoke<int>(A_int_0()), 5);
+#endif
+ //BOOST_TEST_EQ(a(), 4);
+ //BOOST_TEST_EQ(boost::detail::invoke<int>(a), 4);
+ //BOOST_TEST_EQ(ca(), 5);
+ //BOOST_TEST_EQ(boost::detail::invoke<int>(ca), 5);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/thread/test/functional/invoker/invoker_lvalue_pass.cpp b/src/boost/libs/thread/test/functional/invoker/invoker_lvalue_pass.cpp
new file mode 100644
index 00000000..42a98d45
--- /dev/null
+++ b/src/boost/libs/thread/test/functional/invoker/invoker_lvalue_pass.cpp
@@ -0,0 +1,342 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Copyright (C) 2014 Vicente J. Botet Escriba
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// <boost/thread/detail/invoker.hpp>
+
+#include <boost/thread/detail/invoker.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int count = 0;
+
+// 1 arg, return void
+
+void f_void_1(int i)
+{
+ count += i;
+}
+
+struct A_void_1
+{
+ typedef void result_type;
+ void operator()(int i)
+ {
+ count += i;
+ }
+
+ void mem1() {
+ std::cout << "mem1 " << count << std::endl;
+ ++count;
+ std::cout << "mem1 " << count << std::endl;
+ }
+ void mem2() const {count += 2;}
+};
+
+void
+test_void_1()
+{
+ int save_count = count;
+ // function
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ int i = 2;
+ boost::detail::invoker<void(*)(int), int>(f_void_1, i)();
+ BOOST_TEST(count == save_count + 2);
+ save_count = count;
+ }
+#endif
+// {
+// int i = 2;
+// boost::detail::invoke<void>(f_void_1, i);
+// BOOST_TEST(count == save_count + 2);
+// save_count = count;
+// }
+ // function pointer
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ void (*fp)(int) = f_void_1;
+ int i = 3;
+ boost::detail::invoker<void(*)(int), int>(fp, i)();
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+ }
+#endif
+// {
+// void (*fp)(int) = f_void_1;
+// int i = 3;
+// boost::detail::invoke<void>(fp, i);
+// BOOST_TEST(count == save_count+3);
+// save_count = count;
+// }
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ void (*fp)(int) = f_void_1;
+ int i = 3;
+ boost::detail::invoker<void(*)(int), int>(fp, i)();
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+ }
+#endif
+// {
+// void (*fp)(int) = f_void_1;
+// int i = 3;
+// boost::detail::invoke<void>(fp, i);
+// BOOST_TEST(count == save_count+3);
+// save_count = count;
+// }
+ // functor
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ A_void_1 a0;
+ int i = 4;
+ boost::detail::invoker<A_void_1, int>(a0, i)();
+ BOOST_TEST(count == save_count+4);
+ save_count = count;
+ }
+#endif
+// {
+// A_void_1 a0;
+// int i = 4;
+// boost::detail::invoke<void>(a0, i);
+// BOOST_TEST(count == save_count+4);
+// save_count = count;
+// }
+ // member function pointer
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ void (A_void_1::*fp)() = &A_void_1::mem1;
+ A_void_1 a;
+ //BUG
+ boost::detail::invoker<void (A_void_1::*)(), A_void_1>(fp, a)();
+ BOOST_TEST_EQ(count, save_count+1);
+ save_count = count;
+ A_void_1* ap = &a;
+ boost::detail::invoker<void (A_void_1::*)(), A_void_1*>(fp, ap)();
+ BOOST_TEST_EQ(count, save_count+1);
+ save_count = count;
+ }
+#endif
+// {
+// void (A_void_1::*fp)() = &A_void_1::mem1;
+// A_void_1 a;
+// boost::detail::invoke<void>(fp, a);
+// BOOST_TEST(count == save_count+1);
+// save_count = count;
+// A_void_1* ap = &a;
+// boost::detail::invoke<void>(fp, ap);
+// BOOST_TEST(count == save_count+1);
+// save_count = count;
+// }
+ // const member function pointer
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ {
+ void (A_void_1::*fp)() const = &A_void_1::mem2;
+ A_void_1 a;
+ boost::detail::invoker<void (A_void_1::*)() const, A_void_1>(fp, a)();
+ BOOST_TEST(count == save_count+2);
+ save_count = count;
+ A_void_1* ap = &a;
+ boost::detail::invoker<void (A_void_1::*)() const, A_void_1*>(fp, ap)();
+ BOOST_TEST_EQ(count, save_count+2);
+ save_count = count;
+ }
+#endif
+// {
+// void (A_void_1::*fp)() const = &A_void_1::mem2;
+// A_void_1 a;
+// boost::detail::invoke<void>(fp, a);
+// BOOST_TEST(count == save_count+2);
+// save_count = count;
+// A_void_1* ap = &a;
+// boost::detail::invoke<void>(fp, ap);
+// BOOST_TEST(count == save_count+2);
+// save_count = count;
+// }
+}
+
+// 1 arg, return int
+
+int f_int_1(int i)
+{
+ return i + 1;
+}
+
+struct A_int_1
+{
+ A_int_1() : data_(5) {}
+ int operator()(int i)
+ {
+ return i - 1;
+ }
+
+ int mem1() {return 3;}
+ int mem2() const {return 4;}
+ int data_;
+};
+
+void
+test_int_1()
+{
+ // function
+ {
+ int i = 2;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST((boost::detail::invoker<int(*)(int), int>(f_int_1, i)() == 3));
+#endif
+// BOOST_TEST(boost::detail::invoke<int>(f_int_1, i) == 3);
+ }
+ // function pointer
+ {
+ int (*fp)(int) = f_int_1;
+ int i = 3;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST((boost::detail::invoker<int (*)(int), int>(fp, i)() == 4));
+#endif
+// BOOST_TEST(boost::detail::invoke<int>(fp, i) == 4);
+ }
+ // functor
+ {
+ int i = 4;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST((boost::detail::invoker<A_int_1, int>(A_int_1(), i)() == 3));
+#endif
+// const A_int_1 ca;
+// A_int_1 a;
+// BOOST_TEST(boost::detail::invoke<int>(a, i) == 3);
+// //BOOST_TEST(boost::detail::invoke<int>(ca, i) == 3);
+//#if defined BOOST_THREAD_PROVIDES_INVOKE
+// BOOST_TEST(boost::detail::invoke<int>(A_int_1(), i) == 3);
+//#endif
+ }
+ // member function pointer
+ {
+ A_int_1 a;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST((boost::detail::invoker<int (A_int_1::*)(), A_int_1>(&A_int_1::mem1, a)() == 3));
+#endif
+// BOOST_TEST(boost::detail::invoke<int>(&A_int_1::mem1, a) == 3);
+ A_int_1* ap = &a;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST((boost::detail::invoker<int (A_int_1::*)(), A_int_1*>(&A_int_1::mem1, ap)() == 3));
+#endif
+// BOOST_TEST(boost::detail::invoke<int>(&A_int_1::mem1, ap) == 3);
+ }
+ // const member function pointer
+ {
+ A_int_1 a;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST((boost::detail::invoker<int (A_int_1::*)() const, A_int_1>(&A_int_1::mem2, A_int_1())() == 4));
+#endif
+// BOOST_TEST(boost::detail::invoke<int>(&A_int_1::mem2, A_int_1()) == 4);
+ A_int_1* ap = &a;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST((boost::detail::invoker<int (A_int_1::*)() const, A_int_1*>(&A_int_1::mem2, ap)() == 4));
+#endif
+// BOOST_TEST(boost::detail::invoke<int>(&A_int_1::mem2, ap) == 4);
+ }
+ // member data pointer
+ {
+ A_int_1 a;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ // BUG
+ //BOOST_TEST(boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, a) == 5);
+
+// BOOST_TEST(boost::detail::invoke<int>(&A_int_1::data_, a) == 5);
+
+#endif
+//#if defined BOOST_THREAD_PROVIDES_INVOKE
+// A_int_1* ap = &a;
+//
+// boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, a) = 6;
+// BOOST_TEST(boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, a) == 6);
+//
+//// boost::detail::invoke<int>(&A_int_1::data_, a) = 6;
+//// BOOST_TEST(boost::detail::invoke<int>(&A_int_1::data_, a) == 6);
+//
+//#endif
+//
+//#if defined BOOST_THREAD_PROVIDES_INVOKE
+// BOOST_TEST(boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, ap) == 6);
+// boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, ap) = 7;
+// BOOST_TEST(boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, ap) == 7);
+//
+//// BOOST_TEST(boost::detail::invoke<int>(&A_int_1::data_, ap) == 7);
+//// boost::detail::invoke<int>(&A_int_1::data_, ap) = 8;
+//// BOOST_TEST(boost::detail::invoke<int>(&A_int_1::data_, ap) == 8);
+//#endif
+
+ }
+}
+
+// 2 arg, return void
+
+void f_void_2(int i, int j)
+{
+ count += i+j;
+}
+
+struct A_void_2
+{
+ void operator()(int i, int j)
+ {
+ count += i+j;
+ }
+
+ void mem1(int i) {count += i;}
+ void mem2(int i) const {count += i;}
+};
+
+void
+test_void_2()
+{
+ int save_count = count;
+ // function
+ {
+ int i = 2;
+ int j = 3;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ boost::detail::invoke(f_void_2, i, j);
+ BOOST_TEST(count == save_count+5);
+ save_count = count;
+#endif
+// boost::detail::invoke<void>(f_void_2, i, j);
+// BOOST_TEST(count == save_count+5);
+// save_count = count;
+ }
+ // member function pointer
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ int j = 3;
+ boost::detail::invoke(&A_void_2::mem1, A_void_2(), j);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+
+// boost::detail::invoke<void>(&A_void_2::mem1, A_void_2(), j);
+// BOOST_TEST(count == save_count+3);
+// save_count = count;
+#endif
+// A_void_2 a2;
+// boost::detail::invoke<void>(&A_void_2::mem1, a2, j);
+// BOOST_TEST(count == save_count+3);
+// save_count = count;
+ }
+}
+
+int main()
+{
+ test_void_1();
+ test_int_1();
+ test_void_2();
+ return boost::report_errors();
+
+}
diff --git a/src/boost/libs/thread/test/functional/invoker/invoker_rvalue_pass.cpp b/src/boost/libs/thread/test/functional/invoker/invoker_rvalue_pass.cpp
new file mode 100644
index 00000000..ae06e16b
--- /dev/null
+++ b/src/boost/libs/thread/test/functional/invoker/invoker_rvalue_pass.cpp
@@ -0,0 +1,230 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Copyright (C) 2014 Vicente J. Botet Escriba
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// <boost/thread/detail/invoker.hpp>
+
+#if ! defined BOOST_NO_CXX11_DECLTYPE
+//#define BOOST_RESULT_OF_USE_DECLTYPE
+#endif
+
+#include <boost/thread/detail/invoker.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int count = 0;
+
+// 1 arg, return void
+
+void f_void_1(int i)
+{
+ count += i;
+}
+
+struct A_void_1
+{
+ typedef void result_type;
+ void operator()(int i)
+ {
+ count += i;
+ }
+
+ void mem1() {++count;}
+ void mem2() const {count += 2;}
+};
+
+void
+test_void_1()
+{
+ int save_count = count;
+ // function
+ {
+ boost::detail::invoker<void(*)(int), int>(f_void_1, 2)();
+ BOOST_TEST(count == save_count + 2);
+ save_count = count;
+ }
+ // function pointer
+ {
+ void (*fp)(int) = f_void_1;
+ boost::detail::invoker<void(*)(int), int>(fp, 3)();
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+ }
+ // functor
+ {
+ A_void_1 a0;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ boost::detail::invoker<A_void_1, int>(a0, 4)();
+ BOOST_TEST(count == save_count+4);
+ save_count = count;
+#endif
+// boost::detail::invoke<void>(a0, 4);
+// BOOST_TEST(count == save_count+4);
+// save_count = count;
+ }
+ // member function pointer
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ void (A_void_1::*fp)() = &A_void_1::mem1;
+ boost::detail::invoker<void (A_void_1::*)(), A_void_1>(fp, A_void_1())();
+ BOOST_TEST(count == save_count+1);
+ save_count = count;
+
+#endif
+ // boost::detail::invoke<void>(fp, A_void_1());
+ // BOOST_TEST(count == save_count+1);
+ // save_count = count;
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ A_void_1 a;
+ boost::detail::invoker<void (A_void_1::*)(), A_void_1*>(fp, &a)();
+ BOOST_TEST(count == save_count+1);
+ save_count = count;
+
+#endif
+ // boost::detail::invoke<int>(fp, &a);
+ // BOOST_TEST(count == save_count+1);
+ // save_count = count;
+ }
+ // const member function pointer
+ {
+ void (A_void_1::*fp)() const = &A_void_1::mem2;
+ boost::detail::invoker<void (A_void_1::*)() const, A_void_1>(fp, A_void_1())();
+ BOOST_TEST(count == save_count+2);
+ save_count = count;
+ A_void_1 a;
+ boost::detail::invoker<void (A_void_1::*)() const, A_void_1*>(fp, &a)();
+ BOOST_TEST(count == save_count+2);
+ save_count = count;
+ }
+}
+
+// 1 arg, return int
+
+int f_int_1(int i)
+{
+ return i + 1;
+}
+
+struct A_int_1
+{
+ A_int_1() : data_(5) {}
+ int operator()(int i)
+ {
+ return i - 1;
+ }
+
+ int mem1() {return 3;}
+ int mem2() const {return 4;}
+ int data_;
+};
+
+void
+test_int_1()
+{
+ // function
+ {
+ BOOST_TEST((boost::detail::invoker<int (*)(int), int>(f_int_1, 2)() == 3));
+ }
+ // function pointer
+ {
+ int (*fp)(int) = f_int_1;
+ BOOST_TEST((boost::detail::invoker<int (*)(int), int>(fp, 3)() == 4));
+ }
+ // functor
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST((boost::detail::invoker<A_int_1, int>(A_int_1(), 4)() == 3));
+// BOOST_TEST(boost::detail::invoke<int>(A_int_1(), 4) == 3);
+#endif
+ }
+ // member function pointer
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ BOOST_TEST((boost::detail::invoker<int (A_int_1::*)(),A_int_1>(&A_int_1::mem1, A_int_1())() == 3));
+// BOOST_TEST(boost::detail::invoke<int>(&A_int_1::mem1, A_int_1()) == 3);
+#endif
+
+ A_int_1 a;
+ BOOST_TEST((boost::detail::invoker<int (A_int_1::*)(), A_int_1*>(&A_int_1::mem1, &a)() == 3));
+ }
+ // const member function pointer
+ {
+ BOOST_TEST((boost::detail::invoker<int (A_int_1::*)() const, A_int_1>(&A_int_1::mem2, A_int_1())() == 4));
+ A_int_1 a;
+ BOOST_TEST((boost::detail::invoker<int (A_int_1::*)() const, A_int_1*>(&A_int_1::mem2, &a)() == 4));
+ }
+ // member data pointer
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+// BOOST_TEST((boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, A_int_1())() == 5));
+//// BOOST_TEST(boost::detail::invoke<int>(&A_int_1::data_, A_int_1()) == 5);
+// A_int_1 a;
+// BOOST_TEST((boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, a)() == 5));
+// boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, a)() = 6;
+// BOOST_TEST((boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, a)() == 6));
+// BOOST_TEST((boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, &a)() == 6));
+// boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, &a)() = 7;
+// BOOST_TEST((boost::detail::invoker<int A_int_1::*>(&A_int_1::data_, &a)() == 7));
+#endif
+ }
+}
+
+// 2 arg, return void
+
+void f_void_2(int i, int j)
+{
+ count += i+j;
+}
+
+struct A_void_2
+{
+ void operator()(int i, int j)
+ {
+ count += i+j;
+ }
+
+ void mem1(int i) {count += i;}
+ void mem2(int i) const {count += i;}
+};
+
+void
+test_void_2()
+{
+ int save_count = count;
+ // function
+ {
+ boost::detail::invoke(f_void_2, 2, 3);
+ BOOST_TEST(count == save_count+5);
+ save_count = count;
+ }
+ // member function pointer
+ {
+#if defined BOOST_THREAD_PROVIDES_INVOKE
+ boost::detail::invoke(&A_void_2::mem1, A_void_2(), 3);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+
+ boost::detail::invoke<void>(&A_void_2::mem1, A_void_2(), 3);
+ BOOST_TEST(count == save_count+3);
+ save_count = count;
+#endif
+
+ }
+}
+
+int main()
+{
+ test_void_1();
+ test_int_1();
+ test_void_2();
+ return boost::report_errors();
+}