From 8b63c146ea13bd6f21bdd5013b24a830e9ebd528 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 3 Jul 2009 22:22:03 +0000 Subject: [PATCH] Work around Visual C++ copy constructor bug. Fixes #2929. Based on the patch by Steven Watanabe. [SVN r54619] --- include/boost/function/function_base.hpp | 6 ++++++ test/allocator_test.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index fe8e17d..c4663c3 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -262,6 +262,12 @@ namespace boost { A(a) { } + + functor_wrapper(const functor_wrapper& f) : + F(static_cast(f)), + A(static_cast(f)) + { + } }; /** diff --git a/test/allocator_test.cpp b/test/allocator_test.cpp index 7b35f16..3643b2b 100644 --- a/test/allocator_test.cpp +++ b/test/allocator_test.cpp @@ -128,6 +128,10 @@ test_main(int, char*[]) BOOST_CHECK(dealloc_count == 0); fv.assign( &do_nothing, std::allocator() ); fv.clear(); + + function0 fv2; + fv.assign(&do_nothing, std::allocator() ); + fv2.assign(fv, std::allocator() ); return 0; }