From 0d77fd06785a924e8dd022a1f8b3661c5de8e12f Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 10 Jul 2010 21:17:40 +0000 Subject: [PATCH] Merge [62248] to release. Fixes #3856. [SVN r63827] --- include/boost/smart_ptr/make_shared.hpp | 8 ++++---- test/Jamfile.v2 | 1 + test/make_shared_fp_test.cpp | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 test/make_shared_fp_test.cpp diff --git a/include/boost/smart_ptr/make_shared.hpp b/include/boost/smart_ptr/make_shared.hpp index a01cec6..c4ed28a 100644 --- a/include/boost/smart_ptr/make_shared.hpp +++ b/include/boost/smart_ptr/make_shared.hpp @@ -139,7 +139,7 @@ template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a // Variadic templates, rvalue reference -template< class T, class... Args > boost::shared_ptr< T > make_shared( Args && ... args ) +template< class T, class Arg1, class... Args > boost::shared_ptr< T > make_shared( Arg1 && arg1, Args && ... args ) { boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); @@ -147,7 +147,7 @@ template< class T, class... Args > boost::shared_ptr< T > make_shared( Args && . void * pv = pd->address(); - ::new( pv ) T( boost::detail::sp_forward( args )... ); + ::new( pv ) T( boost::detail::sp_forward( arg1 ), boost::detail::sp_forward( args )... ); pd->set_initialized(); T * pt2 = static_cast< T* >( pv ); @@ -156,7 +156,7 @@ template< class T, class... Args > boost::shared_ptr< T > make_shared( Args && . return boost::shared_ptr< T >( pt, pt2 ); } -template< class T, class A, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Args && ... args ) +template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Arg1 && arg1, Args && ... args ) { boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); @@ -164,7 +164,7 @@ template< class T, class A, class... Args > boost::shared_ptr< T > allocate_shar void * pv = pd->address(); - ::new( pv ) T( boost::detail::sp_forward( args )... ); + ::new( pv ) T( boost::detail::sp_forward( arg1 ), boost::detail::sp_forward( args )... ); pd->set_initialized(); T * pt2 = static_cast< T* >( pv ); diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 056b011..9b80ab8 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -63,5 +63,6 @@ import testing ; [ compile-fail auto_ptr_lv_fail.cpp ] [ run atomic_count_test2.cpp ] [ run sp_typeinfo_test.cpp ] + [ compile make_shared_fp_test.cpp ] ; } diff --git a/test/make_shared_fp_test.cpp b/test/make_shared_fp_test.cpp new file mode 100644 index 0000000..f443d34 --- /dev/null +++ b/test/make_shared_fp_test.cpp @@ -0,0 +1,19 @@ +// +// make_shared_fp_test.cpp +// +// Copyright 2010 Georg Fritzsche +// +// 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 +#include + +int main() +{ + typedef boost::shared_ptr(*FP)(); + FP fp = boost::make_shared; +}