Boost logo

Boost-Commit :

From: pdimov_at_[hidden]
Date: 2008-05-07 06:15:16


Author: pdimov
Date: 2008-05-07 06:15:16 EDT (Wed, 07 May 2008)
New Revision: 45194
URL: http://svn.boost.org/trac/boost/changeset/45194

Log:
Fix sp_convertible_test.cpp failure in C++0x mode.
Text files modified:
   trunk/boost/shared_ptr.hpp | 12 ++++++++++--
   trunk/libs/smart_ptr/test/sp_convertible_test.cpp | 5 +++++
   2 files changed, 15 insertions(+), 2 deletions(-)

Modified: trunk/boost/shared_ptr.hpp
==============================================================================
--- trunk/boost/shared_ptr.hpp (original)
+++ trunk/boost/shared_ptr.hpp 2008-05-07 06:15:16 EDT (Wed, 07 May 2008)
@@ -349,7 +349,16 @@
     }
 
     template<class Y>
- shared_ptr( shared_ptr<Y> && r ): px( r.px ), pn() // never throws
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
+
+ shared_ptr( shared_ptr<Y> && r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+
+#else
+
+ shared_ptr( shared_ptr<Y> && r )
+
+#endif
+ : px( r.px ), pn() // never throws
     {
         pn.swap( r.pn );
         r.px = 0;
@@ -772,7 +781,6 @@
 #endif
     }
 
-
     return del;
 }
 

Modified: trunk/libs/smart_ptr/test/sp_convertible_test.cpp
==============================================================================
--- trunk/libs/smart_ptr/test/sp_convertible_test.cpp (original)
+++ trunk/libs/smart_ptr/test/sp_convertible_test.cpp 2008-05-07 06:15:16 EDT (Wed, 07 May 2008)
@@ -59,7 +59,12 @@
 
 int main()
 {
+ boost::shared_ptr<double> p1;
+ BOOST_TEST( 1 == f( p1 ) );
     BOOST_TEST( 1 == f( boost::shared_ptr<double>() ) );
+
+ boost::shared_ptr<Z> p2;
+ BOOST_TEST( 4 == g( p2 ) );
     BOOST_TEST( 4 == g( boost::shared_ptr<Z>() ) );
 
     return boost::report_errors();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk