]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/serialization/test/test_static_warning.cpp
1 // (C) Copyright Jonathan Turkanis 2004.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org for most recent version including documentation.
8 // note: this is a compile only test.
10 #include <boost/config.hpp> // BOOST_STATIC_CONST
11 #include <boost/static_assert.hpp>
12 #include <boost/type_traits/is_polymorphic.hpp>
14 #include <boost/serialization/static_warning.hpp>
20 virtual ~polymorphic();
23 class non_polymorphic
{
28 BOOST_STATIC_WARNING(T::value
);
33 BOOST_STATIC_CONSTANT(bool, value
= false);
36 /////////////////////////////////////////////////////////////////////////
37 // compilation of this program should show a total of 10 warning messages
39 // should show NO warning message
40 BOOST_STATIC_WARNING(true);
42 // the following should show 5 warning message
43 int x
= f
<A
>(); // Warn
44 int y
= f
<boost::is_polymorphic
<non_polymorphic
> >(); // Warn.
45 int z
= f
<boost::is_polymorphic
<polymorphic
> >();
47 BOOST_STATIC_WARNING(sizeof(a1
) == sizeof(a2
)); // Warn.
48 BOOST_STATIC_WARNING(sizeof(a1
) != sizeof(a1
)); // Warn.
49 BOOST_STATIC_WARNING(! boost::is_polymorphic
<polymorphic
>::value
); // Warn.
50 BOOST_STATIC_WARNING(boost::is_polymorphic
<non_polymorphic
>::value
); // Warn.
52 int main(int /* argc */, char * /* argv */[]){
53 // should show NO warning message
54 BOOST_STATIC_WARNING(true);
56 // the following should show 5 warning message
58 BOOST_STATIC_WARNING(sizeof(a1
) == sizeof(a2
)); // Warn.
59 BOOST_STATIC_WARNING(sizeof(a1
) != sizeof(a1
)); // Warn.
60 BOOST_STATIC_WARNING(! boost::is_polymorphic
<polymorphic
>::value
); // Warn.
61 BOOST_STATIC_WARNING(boost::is_polymorphic
<non_polymorphic
>::value
); // Warn.