From 7ee94c69755b029702c2591f496d952e148e3da9 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 21 Mar 2011 09:01:18 +0000 Subject: [PATCH] Function: Extra member tests, to catch #4073. [SVN r70301] --- test/mem_fun_cxx98.cpp | 16 +++++++++++----- test/mem_fun_portable.cpp | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/test/mem_fun_cxx98.cpp b/test/mem_fun_cxx98.cpp index afded46..fba21dd 100644 --- a/test/mem_fun_cxx98.cpp +++ b/test/mem_fun_cxx98.cpp @@ -10,22 +10,28 @@ #include +#include #include #include struct X { int foo(int); + std::ostream& foo2(std::ostream&) const; }; int X::foo(int x) { return -x; } +std::ostream& X::foo2(std::ostream& x) const { return x; } int main() { boost::function f; + boost::function f2; -f = &X::foo; - -X x; -f(&x, 5); + f = &X::foo; + f2 = &X::foo2; - return 0; + X x; + BOOST_TEST(f(&x, 5) == -5); + BOOST_TEST(f2(&x, boost::ref(std::cout)) == std::cout); + + return ::boost::report_errors(); } diff --git a/test/mem_fun_portable.cpp b/test/mem_fun_portable.cpp index 689eb22..b0dcd14 100644 --- a/test/mem_fun_portable.cpp +++ b/test/mem_fun_portable.cpp @@ -10,22 +10,28 @@ #include +#include #include #include struct X { int foo(int); + std::ostream& foo2(std::ostream&) const; }; int X::foo(int x) { return -x; } +std::ostream& X::foo2(std::ostream& x) const { return x; } int main() { boost::function2 f; + boost::function2 f2; -f = &X::foo; - -X x; -f(&x, 5); + f = &X::foo; + f2 = &X::foo2; - return 0; + X x; + BOOST_TEST(f(&x, 5) == -5); + BOOST_TEST(f2(&x, boost::ref(std::cout)) == std::cout); + + return ::boost::report_errors(); }