2 // (C) Copyright John Maddock 2005.
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #include "check_integral_constant.hpp"
10 # include <type_traits>
12 # include <boost/type_traits/has_virtual_destructor.hpp>
18 class polymorphic_no_virtual_destructor
21 virtual void method() = 0;
24 TT_TEST_BEGIN(has_virtual_destructor
)
26 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<int>::value
, false);
27 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<const int>::value
, false);
28 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<volatile int>::value
, false);
29 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<int*>::value
, false);
30 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<int* const>::value
, false);
31 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<int[2]>::value
, false);
32 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<int&>::value
, false);
33 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<mf4
>::value
, false);
34 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<f1
>::value
, false);
35 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<enum_UDT
>::value
, false);
37 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<UDT
>::value
, false);
38 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<empty_UDT
>::value
, false);
40 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<UDT
*>::value
, false);
41 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<UDT
[2]>::value
, false);
42 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<UDT
&>::value
, false);
43 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<void>::value
, false);
45 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<VB
>::value
, true, false);
46 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<VD
>::value
, true, false);
47 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<test_abc1
>::value
, true, false);
48 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<test_abc2
>::value
, true, false);
49 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<polymorphic_no_virtual_destructor
>::value
, false);
50 #ifndef BOOST_NO_STD_LOCALE
51 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<std::iostream
>::value
, true, false);
52 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<std::basic_streambuf
<char> >::value
, true, false);
53 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<std::basic_ios
<char> >::value
, true, false);
54 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<std::basic_istream
<char> >::value
, true, false);
55 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<std::basic_streambuf
<char> >::value
, true, false);
57 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<std::exception
>::value
, true, false);
58 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<std::bad_alloc
>::value
, true, false);
59 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<std::runtime_error
>::value
, true, false);
60 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<std::out_of_range
>::value
, true, false);
61 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor
<std::range_error
>::value
, true, false);