Fix explicit instantiation regression

This commit is contained in:
Peter Dimov
2014-11-12 19:04:29 +02:00
parent aedcf3ccda
commit f65c57d9d2
4 changed files with 31 additions and 2 deletions

View File

@ -655,7 +655,7 @@ public:
BOOST_ASSERT( px != 0 );
BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) );
return px[ i ];
return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] );
}
element_type * get() const BOOST_NOEXCEPT

View File

@ -171,5 +171,7 @@ import testing ;
[ run weak_from_raw_test.cpp ]
[ run weak_from_raw_test2.cpp ]
[ compile sp_explicit_inst_test.cpp ]
;
}

View File

@ -12,8 +12,12 @@ struct X
{
};
template<class T> void f( T & /*t*/ )
{
}
int main()
{
boost::shared_ptr<X> px( new X );
px[ 0 ];
f( px[ 0 ] );
}

View File

@ -0,0 +1,23 @@
//
// Explicit instantiations are reported to exist in user code
//
// Copyright (c) 2014 Peter Dimov
//
// 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 <boost/shared_ptr.hpp>
template class boost::shared_ptr< int >;
struct X
{
};
template class boost::shared_ptr< X >;
int main()
{
}