diff --git a/test/all/Jamfile.v2 b/test/all/Jamfile.v2 index 493bb78b..afa80503 100644 --- a/test/all/Jamfile.v2 +++ b/test/all/Jamfile.v2 @@ -193,6 +193,9 @@ test-suite "BOOST_NO_CXX11_ADDRESSOF" : test-suite "BOOST_NO_CXX11_ALIGNAS" : [ run ../no_cxx11_alignas_pass.cpp ] [ compile-fail ../no_cxx11_alignas_fail.cpp ] ; +test-suite "BOOST_NO_CXX11_ALIGNOF" : +[ run ../no_cxx11_alignof_pass.cpp ] +[ compile-fail ../no_cxx11_alignof_fail.cpp ] ; test-suite "BOOST_NO_CXX11_ALLOCATOR" : [ run ../no_cxx11_allocator_pass.cpp ] [ compile-fail ../no_cxx11_allocator_fail.cpp ] ; diff --git a/test/boost_no_cxx11_alignof.ipp b/test/boost_no_cxx11_alignof.ipp new file mode 100644 index 00000000..43b41493 --- /dev/null +++ b/test/boost_no_cxx11_alignof.ipp @@ -0,0 +1,20 @@ +// Copyright Peter Dimov 2022 + +// 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/libs/config for more information. + +// MACRO: BOOST_NO_CXX11_ALIGNOF +// TITLE: C++11 alignof keyword. +// DESCRIPTION: The compiler does not support the C++11 alignof keyword. + +namespace boost_no_cxx11_alignof { + +int test() +{ + return alignof(int) == alignof(int(&)[2])? 0: 1; +} + +} diff --git a/test/config_info.cpp b/test/config_info.cpp index eaa819a1..aa322fd1 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -1089,6 +1089,7 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_CXX11); PRINT_MACRO(BOOST_NO_CXX11_ADDRESSOF); PRINT_MACRO(BOOST_NO_CXX11_ALIGNAS); + PRINT_MACRO(BOOST_NO_CXX11_ALIGNOF); PRINT_MACRO(BOOST_NO_CXX11_ALLOCATOR); PRINT_MACRO(BOOST_NO_CXX11_ATOMIC_SMART_PTR); PRINT_MACRO(BOOST_NO_CXX11_AUTO_DECLARATIONS); diff --git a/test/config_test.cpp b/test/config_test.cpp index b04e74e1..7d11598c 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -122,6 +122,11 @@ namespace boost_no_cxx11_addressof = empty_boost; #else namespace boost_no_cxx11_alignas = empty_boost; #endif +#ifndef BOOST_NO_CXX11_ALIGNOF +#include "boost_no_cxx11_alignof.ipp" +#else +namespace boost_no_cxx11_alignof = empty_boost; +#endif #ifndef BOOST_NO_CXX11_ALLOCATOR #include "boost_no_cxx11_allocator.ipp" #else @@ -1436,6 +1441,11 @@ int main( int, char *[] ) std::cerr << "Failed test for BOOST_NO_CXX11_ALIGNAS at: " << __FILE__ << ":" << __LINE__ << std::endl; ++error_count; } + if(0 != boost_no_cxx11_alignof::test()) + { + std::cerr << "Failed test for BOOST_NO_CXX11_ALIGNOF at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } if(0 != boost_no_cxx11_allocator::test()) { std::cerr << "Failed test for BOOST_NO_CXX11_ALLOCATOR at: " << __FILE__ << ":" << __LINE__ << std::endl; diff --git a/test/no_cxx11_alignof_fail.cpp b/test/no_cxx11_alignof_fail.cpp new file mode 100644 index 00000000..1feb0832 --- /dev/null +++ b/test/no_cxx11_alignof_fail.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Sun Apr 28 18:36:48 2013 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// 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/libs/config for the most recent version.// +// Revision $Id$ +// + + +// Test file for macro BOOST_NO_CXX11_ALIGNOF +// This file should not compile, if it does then +// BOOST_NO_CXX11_ALIGNOF should not be defined. +// See file boost_no_cxx11_alignof.ipp for details + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include "test.hpp" + +#ifdef BOOST_NO_CXX11_ALIGNOF +#include "boost_no_cxx11_alignof.ipp" +#else +#error "this file should not compile" +#endif + +int main( int, char *[] ) +{ + return boost_no_cxx11_alignof::test(); +} + diff --git a/test/no_cxx11_alignof_pass.cpp b/test/no_cxx11_alignof_pass.cpp new file mode 100644 index 00000000..cd476449 --- /dev/null +++ b/test/no_cxx11_alignof_pass.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Sun Apr 28 18:36:48 2013 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// 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/libs/config for the most recent version.// +// Revision $Id$ +// + + +// Test file for macro BOOST_NO_CXX11_ALIGNOF +// This file should compile, if it does not then +// BOOST_NO_CXX11_ALIGNOF should be defined. +// See file boost_no_cxx11_alignof.ipp for details + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include "test.hpp" + +#ifndef BOOST_NO_CXX11_ALIGNOF +#include "boost_no_cxx11_alignof.ipp" +#else +namespace boost_no_cxx11_alignof = empty_boost; +#endif + +int main( int, char *[] ) +{ + return boost_no_cxx11_alignof::test(); +} +