Changed from boost_no_union_static_data to boost_no_cxx11_unrestricted_union, in both files and macro name. Implemented extended functionality for user-defined classes with non-trivial special member functions in test.

This commit is contained in:
Edward Diener
2019-12-11 21:58:12 -05:00
parent 4031128717
commit 4fdd8bf833
26 changed files with 102 additions and 80 deletions
+3 -3
View File
@@ -595,9 +595,9 @@ test-suite "BOOST_NO_CXX11_UNICODE_LITERALS" :
test-suite "BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX" :
[ run ../no_unified_init_pass.cpp ]
[ compile-fail ../no_unified_init_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_UNION_STATIC_DATA" :
[ run ../no_union_static_data_pass.cpp ]
[ compile-fail ../no_union_static_data_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_UNRESTRICTED_UNION" :
[ run ../no_cxx11_unrestricted_union_pass.cpp ]
[ compile-fail ../no_cxx11_unrestricted_union_fail.cpp ] ;
test-suite "BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL" :
[ run ../no_using_breaks_adl_pass.cpp ]
[ compile-fail ../no_using_breaks_adl_fail.cpp ] ;
@@ -0,0 +1,55 @@
// (C) Copyright Edward Diener 2019
// 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_UNRESTRICTED_UNION
// TITLE: C++11 unrestricted union
// DESCRIPTION: The compiler does not support the C++11 unrestricted union
#include <new>
namespace boost_no_cxx11_unrestricted_union {
struct HoldsShort
{
short i;
HoldsShort();
};
HoldsShort::HoldsShort() : i(1)
{
}
union with_static_data
{
int a;
long b;
HoldsShort o;
with_static_data();
static int sd;
};
with_static_data::with_static_data() :
a(0)
{
}
int with_static_data::sd = 0;
int test()
{
with_static_data wsd;
wsd.a = 24;
wsd.b = 48L;
new(&wsd.o) HoldsShort;
wsd.o.i = 2;
with_static_data::sd = 1;
bool b = (wsd.o.i == 2 && with_static_data::sd == 1);
return b ? 0 : 1;
}
}
-34
View File
@@ -1,34 +0,0 @@
// (C) Copyright Edward Diener 2019
// 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_UNION_STATIC_DATA
// TITLE: C++11 union with static data unavailable
// DESCRIPTION: The compiler does not support C++11 union with static data
namespace boost_no_cxx11_union_static_data {
union with_static_data
{
int a;
long b;
static int sd;
};
int with_static_data::sd = 0;
int test()
{
with_static_data wsd;
wsd.a = 24;
wsd.b = 48L;
with_static_data::sd = 1;
bool b = (wsd.b == 48L && with_static_data::sd == 1);
return b ? 0 : 1;
}
}
+1 -1
View File
@@ -1145,7 +1145,7 @@ void print_boost_macros()
PRINT_MACRO(BOOST_NO_CXX11_TRAILING_RESULT_TYPES);
PRINT_MACRO(BOOST_NO_CXX11_UNICODE_LITERALS);
PRINT_MACRO(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX);
PRINT_MACRO(BOOST_NO_CXX11_UNION_STATIC_DATA);
PRINT_MACRO(BOOST_NO_CXX11_UNRESTRICTED_UNION);
PRINT_MACRO(BOOST_NO_CXX11_USER_DEFINED_LITERALS);
PRINT_MACRO(BOOST_NO_CXX11_VARIADIC_MACROS);
PRINT_MACRO(BOOST_NO_CXX11_VARIADIC_TEMPLATES);
+5 -5
View File
@@ -792,10 +792,10 @@ namespace boost_no_cxx11_unicode_literals = empty_boost;
#else
namespace boost_no_cxx11_unified_initialization_syntax = empty_boost;
#endif
#ifndef BOOST_NO_CXX11_UNION_STATIC_DATA
#include "boost_no_union_static_data.ipp"
#ifndef BOOST_NO_CXX11_UNRESTRICTED_UNION
#include "boost_no_cxx11_unrestricted_union.ipp"
#else
namespace boost_no_cxx11_union_static_data = empty_boost;
namespace boost_no_cxx11_unrestricted_union = empty_boost;
#endif
#ifndef BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
#include "boost_no_using_breaks_adl.ipp"
@@ -1976,9 +1976,9 @@ int main( int, char *[] )
std::cerr << "Failed test for BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX at: " << __FILE__ << ":" << __LINE__ << std::endl;
++error_count;
}
if(0 != boost_no_cxx11_union_static_data::test())
if(0 != boost_no_cxx11_unrestricted_union::test())
{
std::cerr << "Failed test for BOOST_NO_CXX11_UNION_STATIC_DATA at: " << __FILE__ << ":" << __LINE__ << std::endl;
std::cerr << "Failed test for BOOST_NO_CXX11_UNRESTRICTED_UNION at: " << __FILE__ << ":" << __LINE__ << std::endl;
++error_count;
}
if(0 != boost_function_scope_using_declaration_breaks_adl::test())
@@ -10,10 +10,10 @@
//
// Test file for macro BOOST_NO_CXX11_UNION_STATIC_DATA
// Test file for macro BOOST_NO_CXX11_UNRESTRICTED_UNION
// This file should not compile, if it does then
// BOOST_NO_CXX11_UNION_STATIC_DATA should not be defined.
// See file boost_no_union_static_data.ipp for details
// BOOST_NO_CXX11_UNRESTRICTED_UNION should not be defined.
// See file boost_no_cxx11_unrestricted_union.ipp for details
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
@@ -24,14 +24,14 @@
#include <boost/config.hpp>
#include "test.hpp"
#ifdef BOOST_NO_CXX11_UNION_STATIC_DATA
#include "boost_no_union_static_data.ipp"
#ifdef BOOST_NO_CXX11_UNRESTRICTED_UNION
#include "boost_no_cxx11_unrestricted_union.ipp"
#else
#error "this file should not compile"
#endif
int main( int, char *[] )
{
return boost_no_cxx11_union_static_data::test();
return boost_no_cxx11_unrestricted_union::test();
}
@@ -10,10 +10,10 @@
//
// Test file for macro BOOST_NO_CXX11_UNION_STATIC_DATA
// Test file for macro BOOST_NO_CXX11_UNRESTRICTED_UNION
// This file should compile, if it does not then
// BOOST_NO_CXX11_UNION_STATIC_DATA should be defined.
// See file boost_no_union_static_data.ipp for details
// BOOST_NO_CXX11_UNRESTRICTED_UNION should be defined.
// See file boost_no_cxx11_unrestricted_union.ipp for details
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
@@ -24,14 +24,14 @@
#include <boost/config.hpp>
#include "test.hpp"
#ifndef BOOST_NO_CXX11_UNION_STATIC_DATA
#include "boost_no_union_static_data.ipp"
#ifndef BOOST_NO_CXX11_UNRESTRICTED_UNION
#include "boost_no_cxx11_unrestricted_union.ipp"
#else
namespace boost_no_cxx11_union_static_data = empty_boost;
namespace boost_no_cxx11_unrestricted_union = empty_boost;
#endif
int main( int, char *[] )
{
return boost_no_cxx11_union_static_data::test();
return boost_no_cxx11_unrestricted_union::test();
}