Boost logo

Boost-Commit :

From: ramey_at_[hidden]
Date: 2008-03-27 13:12:22


Author: ramey
Date: 2008-03-27 13:12:22 EDT (Thu, 27 Mar 2008)
New Revision: 43883
URL: http://svn.boost.org/trac/boost/changeset/43883

Log:
added test to check warnings on type trait
Text files modified:
   trunk/libs/serialization/test/test_static_warning.cpp | 18 ++++++++++++++++--
   1 files changed, 16 insertions(+), 2 deletions(-)

Modified: trunk/libs/serialization/test/test_static_warning.cpp
==============================================================================
--- trunk/libs/serialization/test/test_static_warning.cpp (original)
+++ trunk/libs/serialization/test/test_static_warning.cpp 2008-03-27 13:12:22 EDT (Thu, 27 Mar 2008)
@@ -8,20 +8,34 @@
 // note: this is a compile only test.
 
 #include <boost/static_warning.hpp>
+#include <boost/type_traits/is_polymorphic.hpp>
 
 #pragma warning(disable:4094)
 
 typedef char a1[2];
 typedef char a2[3];
 
+class polymorphic {
+ virtual ~polymorphic();
+};
+
+class non_polymorphic {
+};
+
+// note: compilation of this program should show 8 warning messages
+
 BOOST_STATIC_WARNING(true);
 BOOST_STATIC_WARNING(sizeof(a1) == sizeof(a2)); // Warn.
-BOOST_STATIC_WARNING(sizeof(a1) == sizeof(a2)); // Warn.
+BOOST_STATIC_WARNING(sizeof(a1) != sizeof(a1)); // Warn.
+BOOST_STATIC_WARNING(! boost::is_polymorphic<polymorphic>::value); // Warn.
+BOOST_STATIC_WARNING(boost::is_polymorphic<non_polymorphic>::value); // Warn.
 
 void warnings() {
     BOOST_STATIC_WARNING(true);
     BOOST_STATIC_WARNING(sizeof(a1) == sizeof(a2)); // Warn.
- BOOST_STATIC_WARNING(sizeof(a1) == sizeof(a2)); // Warn.
+ BOOST_STATIC_WARNING(sizeof(a1) != sizeof(a1)); // Warn.
+ BOOST_STATIC_WARNING(! boost::is_polymorphic<polymorphic>::value); // Warn.
+ BOOST_STATIC_WARNING(boost::is_polymorphic<non_polymorphic>::value); // Warn.
 }
 
 int main(int /* argc */, char * /* argv */[]){


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk