summaryrefslogtreecommitdiff
path: root/libs/bind/test
diff options
context:
space:
mode:
Diffstat (limited to 'libs/bind/test')
-rw-r--r--libs/bind/test/Jamfile.v26
-rw-r--r--libs/bind/test/bind_function2_test.cpp118
-rw-r--r--libs/bind/test/bind_fwd2_test.cpp121
-rw-r--r--libs/bind/test/bind_fwd_test.cpp250
-rw-r--r--libs/bind/test/bind_void_dm_test.cpp72
-rw-r--r--libs/bind/test/bind_void_mf_test.cpp171
-rw-r--r--libs/bind/test/bind_void_test.cpp139
7 files changed, 877 insertions, 0 deletions
diff --git a/libs/bind/test/Jamfile.v2 b/libs/bind/test/Jamfile.v2
index 68dc83ddf..52e57cdb2 100644
--- a/libs/bind/test/Jamfile.v2
+++ b/libs/bind/test/Jamfile.v2
@@ -28,6 +28,9 @@ test-suite "bind"
[ run bind_placeholder_test.cpp ]
[ run bind_rvalue_test.cpp ]
[ run bind_and_or_test.cpp ]
+ [ run bind_void_test.cpp ]
+ [ run bind_void_dm_test.cpp ]
+ [ run bind_void_mf_test.cpp ]
[ run mem_fn_test.cpp ]
[ run mem_fn_void_test.cpp ]
[ run mem_fn_derived_test.cpp ]
@@ -44,4 +47,7 @@ test-suite "bind"
[ run bind_eq3_test.cpp ]
[ run protect_test.cpp ]
[ run mem_fn_unary_addr_test.cpp ]
+ [ run bind_function2_test.cpp ]
+ [ run bind_fwd_test.cpp ]
+ [ run bind_fwd2_test.cpp ]
;
diff --git a/libs/bind/test/bind_function2_test.cpp b/libs/bind/test/bind_function2_test.cpp
new file mode 100644
index 000000000..f991248a2
--- /dev/null
+++ b/libs/bind/test/bind_function2_test.cpp
@@ -0,0 +1,118 @@
+#include <boost/config.hpp>
+
+//
+// bind_function2_test.cpp - regression test
+//
+// Copyright (c) 2015 Peter Dimov
+//
+// 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+void fv1( int & a )
+{
+ a = 17041;
+}
+
+void fv2( int & a, int b )
+{
+ a = b;
+}
+
+void fv3( int & a, int b, int c )
+{
+ a = b + c;
+}
+
+void fv4( int & a, int b, int c, int d )
+{
+ a = b + c + d;
+}
+
+void fv5( int & a, int b, int c, int d, int e )
+{
+ a = b + c + d + e;
+}
+
+void fv6( int & a, int b, int c, int d, int e, int f )
+{
+ a = b + c + d + e + f;
+}
+
+void fv7( int & a, int b, int c, int d, int e, int f, int g )
+{
+ a = b + c + d + e + f + g;
+}
+
+void fv8( int & a, int b, int c, int d, int e, int f, int g, int h )
+{
+ a = b + c + d + e + f + g + h;
+}
+
+void fv9( int & a, int b, int c, int d, int e, int f, int g, int h, int i )
+{
+ a = b + c + d + e + f + g + h + i;
+}
+
+void function_test()
+{
+ int x = 0;
+
+ {
+ boost::function<void(int&)> fw1 = boost::bind( fv1, _1 );
+ fw1( x ); BOOST_TEST( x == 17041 );
+ }
+
+ {
+ boost::function<void(int&, int)> fw2 = boost::bind( fv2, _1, _2 );
+ fw2( x, 1 ); BOOST_TEST( x == 1 );
+ }
+
+ {
+ boost::function<void(int&, int, int)> fw3 = boost::bind( fv3, _1, _2, _3 );
+ fw3( x, 1, 2 ); BOOST_TEST( x == 1+2 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int)> fw4 = boost::bind( fv4, _1, _2, _3, _4 );
+ fw4( x, 1, 2, 3 ); BOOST_TEST( x == 1+2+3 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int, int)> fw5 = boost::bind( fv5, _1, _2, _3, _4, _5 );
+ fw5( x, 1, 2, 3, 4 ); BOOST_TEST( x == 1+2+3+4 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int, int, int)> fw6 = boost::bind( fv6, _1, _2, _3, _4, _5, _6 );
+ fw6( x, 1, 2, 3, 4, 5 ); BOOST_TEST( x == 1+2+3+4+5 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int, int, int, int)> fw7 = boost::bind( fv7, _1, _2, _3, _4, _5, _6, _7 );
+ fw7( x, 1, 2, 3, 4, 5, 6 ); BOOST_TEST( x == 1+2+3+4+5+6 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int, int, int, int, int)> fw8 = boost::bind( fv8, _1, _2, _3, _4, _5, _6, _7, _8 );
+ fw8( x, 1, 2, 3, 4, 5, 6, 7 ); BOOST_TEST( x == 1+2+3+4+5+6+7 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int, int, int, int, int, int)> fw9 = boost::bind( fv9, _1, _2, _3, _4, _5, _6, _7, _8, _9 );
+ fw9( x, 1, 2, 3, 4, 5, 6, 7, 8 ); BOOST_TEST( x == 1+2+3+4+5+6+7+8 );
+ }
+}
+
+int main()
+{
+ function_test();
+ return boost::report_errors();
+}
diff --git a/libs/bind/test/bind_fwd2_test.cpp b/libs/bind/test/bind_fwd2_test.cpp
new file mode 100644
index 000000000..5b7bf9cdc
--- /dev/null
+++ b/libs/bind/test/bind_fwd2_test.cpp
@@ -0,0 +1,121 @@
+#include <boost/config.hpp>
+
+//
+// bind_fwd2_test.cpp - forwarding test for 2 arguments
+//
+// Copyright (c) 2015 Peter Dimov
+//
+// 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+int fv1( int const & a )
+{
+ return a;
+}
+
+void fv2_1( int & a, int const & b )
+{
+ a = b;
+}
+
+void fv2_2( int const & a, int & b )
+{
+ b = a;
+}
+
+int fv2_3( int const & a, int const & b )
+{
+ return a+b;
+}
+
+void test()
+{
+ {
+ int const a = 1;
+ int r = boost::bind( fv1, _1 )( a );
+ BOOST_TEST( r == 1 );
+ }
+
+ {
+ int r = boost::bind( fv1, _1 )( 1 );
+ BOOST_TEST( r == 1 );
+ }
+
+ {
+ int a = 1;
+ int const b = 2;
+
+ boost::bind( fv2_1, _1, _2 )( a, b );
+
+ BOOST_TEST( a == 2 );
+ }
+
+ {
+ int a = 1;
+
+ boost::bind( fv2_1, _1, _2 )( a, 2 );
+
+ BOOST_TEST( a == 2 );
+ }
+
+ {
+ int const a = 1;
+ int b = 2;
+
+ boost::bind( fv2_2, _1, _2 )( a, b );
+
+ BOOST_TEST( b == 1 );
+ }
+
+ {
+ int b = 2;
+
+ boost::bind( fv2_2, _1, _2 )( 1, b );
+
+ BOOST_TEST( b == 1 );
+ }
+
+ {
+ int const a = 1;
+ int const b = 2;
+
+ int r = boost::bind( fv2_3, _1, _2 )( a, b );
+
+ BOOST_TEST( r == 3 );
+ }
+
+ {
+ int const a = 1;
+
+ int r = boost::bind( fv2_3, _1, _2 )( a, 2 );
+
+ BOOST_TEST( r == 3 );
+ }
+
+ {
+ int const b = 2;
+
+ int r = boost::bind( fv2_3, _1, _2 )( 1, b );
+
+ BOOST_TEST( r == 3 );
+ }
+
+ {
+ int r = boost::bind( fv2_3, _1, _2 )( 1, 2 );
+
+ BOOST_TEST( r == 3 );
+ }
+}
+
+int main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/libs/bind/test/bind_fwd_test.cpp b/libs/bind/test/bind_fwd_test.cpp
new file mode 100644
index 000000000..92bd3b184
--- /dev/null
+++ b/libs/bind/test/bind_fwd_test.cpp
@@ -0,0 +1,250 @@
+#include <boost/config.hpp>
+
+//
+// bind_fwd_test.cpp - forwarding test
+//
+// Copyright (c) 2015 Peter Dimov
+//
+// 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+void fv1( int & a )
+{
+ a = 1;
+}
+
+void fv2( int & a, int & b )
+{
+ a = 1;
+ b = 2;
+}
+
+void fv3( int & a, int & b, int & c )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+}
+
+void fv4( int & a, int & b, int & c, int & d )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+}
+
+void fv5( int & a, int & b, int & c, int & d, int & e )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+}
+
+void fv6( int & a, int & b, int & c, int & d, int & e, int & f )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+ f = 6;
+}
+
+void fv7( int & a, int & b, int & c, int & d, int & e, int & f, int & g )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+ f = 6;
+ g = 7;
+}
+
+void fv8( int & a, int & b, int & c, int & d, int & e, int & f, int & g, int & h )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+ f = 6;
+ g = 7;
+ h = 8;
+}
+
+void fv9( int & a, int & b, int & c, int & d, int & e, int & f, int & g, int & h, int & i )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+ f = 6;
+ g = 7;
+ h = 8;
+ i = 9;
+}
+
+void test()
+{
+ {
+ int a = 0;
+
+ boost::bind( fv1, _1 )( a );
+
+ BOOST_TEST( a == 1 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+
+ boost::bind( fv2, _1, _2 )( a, b );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+
+ boost::bind( fv3, _1, _2, _3 )( a, b, c );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+
+ boost::bind( fv4, _1, _2, _3, _4 )( a, b, c, d );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+ int e = 0;
+
+ boost::bind( fv5, _1, _2, _3, _4, _5 )( a, b, c, d, e );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ BOOST_TEST( e == 5 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+ int e = 0;
+ int f = 0;
+
+ boost::bind( fv6, _1, _2, _3, _4, _5, _6 )( a, b, c, d, e, f );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ BOOST_TEST( e == 5 );
+ BOOST_TEST( f == 6 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+ int e = 0;
+ int f = 0;
+ int g = 0;
+
+ boost::bind( fv7, _1, _2, _3, _4, _5, _6, _7 )( a, b, c, d, e, f, g );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ BOOST_TEST( e == 5 );
+ BOOST_TEST( f == 6 );
+ BOOST_TEST( g == 7 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+ int e = 0;
+ int f = 0;
+ int g = 0;
+ int h = 0;
+
+ boost::bind( fv8, _1, _2, _3, _4, _5, _6, _7, _8 )( a, b, c, d, e, f, g, h );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ BOOST_TEST( e == 5 );
+ BOOST_TEST( f == 6 );
+ BOOST_TEST( g == 7 );
+ BOOST_TEST( h == 8 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+ int e = 0;
+ int f = 0;
+ int g = 0;
+ int h = 0;
+ int i = 0;
+
+ boost::bind( fv9, _1, _2, _3, _4, _5, _6, _7, _8, _9 )( a, b, c, d, e, f, g, h, i );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ BOOST_TEST( e == 5 );
+ BOOST_TEST( f == 6 );
+ BOOST_TEST( g == 7 );
+ BOOST_TEST( h == 8 );
+ BOOST_TEST( i == 9 );
+ }
+}
+
+int main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/libs/bind/test/bind_void_dm_test.cpp b/libs/bind/test/bind_void_dm_test.cpp
new file mode 100644
index 000000000..ffa60f9ae
--- /dev/null
+++ b/libs/bind/test/bind_void_dm_test.cpp
@@ -0,0 +1,72 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_void_mf_test.cpp - test for bind<void> with member functions
+//
+// Copyright (c) 2008 Peter Dimov
+// Copyright (c) 2014 Agustin Berge
+//
+// 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)
+//
+
+#include <boost/bind.hpp>
+#include <boost/ref.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+struct Z
+{
+ int m;
+};
+
+void member_data_test()
+{
+ Z z = { 17041 };
+ Z * pz = &z;
+
+ boost::bind<void>( &Z::m, _1 )( z );
+ boost::bind<void>( &Z::m, _1 )( pz );
+
+ boost::bind<void>( &Z::m, z )();
+ boost::bind<void>( &Z::m, pz )();
+ boost::bind<void>( &Z::m, boost::ref(z) )();
+
+
+ Z const cz = z;
+ Z const * pcz = &cz;
+
+ boost::bind<void>( &Z::m, _1 )( cz );
+ boost::bind<void>( &Z::m, _1 )( pcz );
+
+ boost::bind<void>( &Z::m, cz )();
+ boost::bind<void>( &Z::m, pcz )();
+ boost::bind<void>( &Z::m, boost::ref(cz) )();
+}
+
+int main()
+{
+ member_data_test();
+
+ return boost::report_errors();
+}
diff --git a/libs/bind/test/bind_void_mf_test.cpp b/libs/bind/test/bind_void_mf_test.cpp
new file mode 100644
index 000000000..62c2dcda7
--- /dev/null
+++ b/libs/bind/test/bind_void_mf_test.cpp
@@ -0,0 +1,171 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_void_mf_test.cpp - test for bind<void> with member functions
+//
+// Copyright (c) 2008 Peter Dimov
+// Copyright (c) 2014 Agustin Berge
+//
+// 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)
+//
+
+#include <boost/bind.hpp>
+#include <boost/ref.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+long global_result;
+
+//
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int f0() { f1(17); return 0; }
+ int g0() const { g1(17); return 0; }
+
+ int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+void member_function_test()
+{
+ using namespace boost;
+
+ X x;
+
+ // 0
+
+ bind<void>(&X::f0, &x)();
+ bind<void>(&X::f0, ref(x))();
+
+ bind<void>(&X::g0, &x)();
+ bind<void>(&X::g0, x)();
+ bind<void>(&X::g0, ref(x))();
+
+ // 1
+
+ bind<void>(&X::f1, &x, 1)();
+ bind<void>(&X::f1, ref(x), 1)();
+
+ bind<void>(&X::g1, &x, 1)();
+ bind<void>(&X::g1, x, 1)();
+ bind<void>(&X::g1, ref(x), 1)();
+
+ // 2
+
+ bind<void>(&X::f2, &x, 1, 2)();
+ bind<void>(&X::f2, ref(x), 1, 2)();
+
+ bind<void>(&X::g2, &x, 1, 2)();
+ bind<void>(&X::g2, x, 1, 2)();
+ bind<void>(&X::g2, ref(x), 1, 2)();
+
+ // 3
+
+ bind<void>(&X::f3, &x, 1, 2, 3)();
+ bind<void>(&X::f3, ref(x), 1, 2, 3)();
+
+ bind<void>(&X::g3, &x, 1, 2, 3)();
+ bind<void>(&X::g3, x, 1, 2, 3)();
+ bind<void>(&X::g3, ref(x), 1, 2, 3)();
+
+ // 4
+
+ bind<void>(&X::f4, &x, 1, 2, 3, 4)();
+ bind<void>(&X::f4, ref(x), 1, 2, 3, 4)();
+
+ bind<void>(&X::g4, &x, 1, 2, 3, 4)();
+ bind<void>(&X::g4, x, 1, 2, 3, 4)();
+ bind<void>(&X::g4, ref(x), 1, 2, 3, 4)();
+
+ // 5
+
+ bind<void>(&X::f5, &x, 1, 2, 3, 4, 5)();
+ bind<void>(&X::f5, ref(x), 1, 2, 3, 4, 5)();
+
+ bind<void>(&X::g5, &x, 1, 2, 3, 4, 5)();
+ bind<void>(&X::g5, x, 1, 2, 3, 4, 5)();
+ bind<void>(&X::g5, ref(x), 1, 2, 3, 4, 5)();
+
+ // 6
+
+ bind<void>(&X::f6, &x, 1, 2, 3, 4, 5, 6)();
+ bind<void>(&X::f6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ bind<void>(&X::g6, &x, 1, 2, 3, 4, 5, 6)();
+ bind<void>(&X::g6, x, 1, 2, 3, 4, 5, 6)();
+ bind<void>(&X::g6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ // 7
+
+ bind<void>(&X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind<void>(&X::f7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ bind<void>(&X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind<void>(&X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
+ bind<void>(&X::g7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ // 8
+
+ bind<void>(&X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind<void>(&X::f8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ bind<void>(&X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind<void>(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind<void>(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ BOOST_TEST( x.hash == 23558 );
+}
+
+int main()
+{
+ member_function_test();
+
+ return boost::report_errors();
+}
diff --git a/libs/bind/test/bind_void_test.cpp b/libs/bind/test/bind_void_test.cpp
new file mode 100644
index 000000000..bb1e80dae
--- /dev/null
+++ b/libs/bind/test/bind_void_test.cpp
@@ -0,0 +1,139 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_void_test.cpp - test for bind<void>
+//
+// Copyright (c) 2008 Peter Dimov
+// Copyright (c) 2014 Agustin Berge
+//
+// 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)
+//
+
+#include <boost/bind.hpp>
+#include <boost/ref.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+long global_result;
+
+long f_0()
+{
+ return global_result = 17041L;
+}
+
+long f_1(long a)
+{
+ return global_result = a;
+}
+
+long f_2(long a, long b)
+{
+ return global_result = a + 10 * b;
+}
+
+long f_3(long a, long b, long c)
+{
+ return global_result = a + 10 * b + 100 * c;
+}
+
+long f_4(long a, long b, long c, long d)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d;
+}
+
+long f_5(long a, long b, long c, long d, long e)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+long f_6(long a, long b, long c, long d, long e, long f)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+long f_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+long f_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+long f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+void function_test()
+{
+ using namespace boost;
+
+ int const i = 1;
+
+ BOOST_TEST( (bind<void>(f_0)(i), (global_result == 17041L)) );
+ BOOST_TEST( (bind<void>(f_1, _1)(i), (global_result == 1L)) );
+ BOOST_TEST( (bind<void>(f_2, _1, 2)(i), (global_result == 21L)) );
+ BOOST_TEST( (bind<void>(f_3, _1, 2, 3)(i), (global_result == 321L)) );
+ BOOST_TEST( (bind<void>(f_4, _1, 2, 3, 4)(i), (global_result == 4321L)) );
+ BOOST_TEST( (bind<void>(f_5, _1, 2, 3, 4, 5)(i), (global_result == 54321L)) );
+ BOOST_TEST( (bind<void>(f_6, _1, 2, 3, 4, 5, 6)(i), (global_result == 654321L)) );
+ BOOST_TEST( (bind<void>(f_7, _1, 2, 3, 4, 5, 6, 7)(i), (global_result == 7654321L)) );
+ BOOST_TEST( (bind<void>(f_8, _1, 2, 3, 4, 5, 6, 7, 8)(i), (global_result == 87654321L)) );
+ BOOST_TEST( (bind<void>(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i), (global_result == 987654321L)) );
+}
+
+//
+
+struct Y
+{
+ short operator()(short & r) const { return global_result = ++r; }
+ int operator()(int a, int b) const { return global_result = a + 10 * b; }
+ long operator() (long a, long b, long c) const { return global_result = a + 10 * b + 100 * c; }
+ void operator() (long a, long b, long c, long d) const { global_result = a + 10 * b + 100 * c + 1000 * d; }
+};
+
+void function_object_test()
+{
+ using namespace boost;
+
+ short i(6);
+
+ int const k = 3;
+
+ BOOST_TEST( (bind<void>(Y(), ref(i))(), (global_result == 7)) );
+ BOOST_TEST( (bind<void>(Y(), ref(i))(), (global_result == 8)) );
+ BOOST_TEST( (bind<void>(Y(), i, _1)(k), (global_result == 38)) );
+ BOOST_TEST( (bind<void>(Y(), i, _1, 9)(k), (global_result == 938)) );
+ BOOST_TEST( (bind<void>(Y(), i, _1, 9, 4)(k), (global_result == 4938)) );
+}
+
+int main()
+{
+ function_test();
+ function_object_test();
+
+ return boost::report_errors();
+}