Add get_deleter test with an incomplete class

This commit is contained in:
Peter Dimov
2017-06-20 17:47:17 +03:00
parent 014181e1f9
commit 1c097b5764
2 changed files with 39 additions and 0 deletions

View File

@ -218,6 +218,8 @@ import testing ;
[ run atomic_sp_constexpr_test.cpp ]
[ run get_deleter_test2.cpp ]
[ run local_sp_test.cpp ]
[ run lsp_array_test.cpp ]
[ run lsp_array_n_test.cpp ]

View File

@ -0,0 +1,37 @@
//
// get_deleter_test2.cpp
//
// Copyright 2017 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>
#include <boost/core/lightweight_test.hpp>
struct deleter;
struct X
{
};
static void test_get_deleter( boost::shared_ptr<X> const & p )
{
BOOST_TEST( boost::get_deleter<deleter>( p ) != 0 );
}
struct deleter
{
void operator()( X const * p ) { delete p; }
};
int main()
{
boost::shared_ptr<X> p( new X, deleter() );
test_get_deleter( p );
return boost::report_errors();
}