diff --git a/include/boost/smart_ptr/detail/array_allocator.hpp b/include/boost/smart_ptr/detail/array_allocator.hpp index 069f844..fb8e662 100644 --- a/include/boost/smart_ptr/detail/array_allocator.hpp +++ b/include/boost/smart_ptr/detail/array_allocator.hpp @@ -108,14 +108,14 @@ namespace boost { typedef typename array_base::type type; - as_allocator(const A& allocator, type** result) - : A(allocator), + as_allocator(const A& allocator_, type** result) + : A(allocator_), data(result) { } - as_allocator(const A& allocator, std::size_t size, + as_allocator(const A& allocator_, std::size_t size, type** result) - : A(allocator), + : A(allocator_), data(size, result) { } diff --git a/include/boost/smart_ptr/detail/sp_forward.hpp b/include/boost/smart_ptr/detail/sp_forward.hpp index 5f1d190..3372665 100644 --- a/include/boost/smart_ptr/detail/sp_forward.hpp +++ b/include/boost/smart_ptr/detail/sp_forward.hpp @@ -25,6 +25,17 @@ namespace detail #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) +#if defined( __GNUC__ ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404 + +// GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object. +// This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward. +template< class T > T&& sp_forward( T && t ) BOOST_NOEXCEPT +{ + return t; +} + +#else + template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT { return static_cast< T&& >( t ); @@ -32,6 +43,8 @@ template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT #endif +#endif + } // namespace detail } // namespace boost