From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- .../serialization/test/test_static_warning.cpp | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/boost/libs/serialization/test/test_static_warning.cpp (limited to 'src/boost/libs/serialization/test/test_static_warning.cpp') diff --git a/src/boost/libs/serialization/test/test_static_warning.cpp b/src/boost/libs/serialization/test/test_static_warning.cpp new file mode 100644 index 000000000..642b9cf3a --- /dev/null +++ b/src/boost/libs/serialization/test/test_static_warning.cpp @@ -0,0 +1,63 @@ +// (C) Copyright Jonathan Turkanis 2004. +// Use, modification and distribution are subject to 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) + +// See http://www.boost.org for most recent version including documentation. + +// note: this is a compile only test. + +#include // BOOST_STATIC_CONST +#include +#include + +#include + +typedef char a1[2]; +typedef char a2[3]; + +class polymorphic { + virtual ~polymorphic(); +}; + +class non_polymorphic { +}; + +template +int f(){ + BOOST_STATIC_WARNING(T::value); + return 0; +} + +struct A { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +///////////////////////////////////////////////////////////////////////// +// compilation of this program should show a total of 10 warning messages + +// should show NO warning message +BOOST_STATIC_WARNING(true); + +// the following should show 5 warning message +int x = f(); // Warn +int y = f >(); // Warn. +int z = f >(); + +BOOST_STATIC_WARNING(sizeof(a1) == sizeof(a2)); // Warn. +BOOST_STATIC_WARNING(sizeof(a1) != sizeof(a1)); // Warn. +BOOST_STATIC_WARNING(! boost::is_polymorphic::value); // Warn. +BOOST_STATIC_WARNING(boost::is_polymorphic::value); // Warn. + +int main(int /* argc */, char * /* argv */[]){ + // should show NO warning message + BOOST_STATIC_WARNING(true); + + // the following should show 5 warning message + f(); + BOOST_STATIC_WARNING(sizeof(a1) == sizeof(a2)); // Warn. + BOOST_STATIC_WARNING(sizeof(a1) != sizeof(a1)); // Warn. + BOOST_STATIC_WARNING(! boost::is_polymorphic::value); // Warn. + BOOST_STATIC_WARNING(boost::is_polymorphic::value); // Warn. + return 0; +} -- cgit v1.2.3