mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-29 20:37:13 +02:00
Fix explicit instantiation regression
This commit is contained in:
@ -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
|
||||
|
@ -171,5 +171,7 @@ import testing ;
|
||||
|
||||
[ run weak_from_raw_test.cpp ]
|
||||
[ run weak_from_raw_test2.cpp ]
|
||||
|
||||
[ compile sp_explicit_inst_test.cpp ]
|
||||
;
|
||||
}
|
||||
|
@ -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 ] );
|
||||
}
|
||||
|
23
test/sp_explicit_inst_test.cpp
Normal file
23
test/sp_explicit_inst_test.cpp
Normal 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()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user