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

View File

@ -201,7 +201,7 @@ obj typeid : test_case.cpp : <define>TEST_BOOST_NO_TYPEID ;
obj typename_with_ctor : test_case.cpp : <define>TEST_BOOST_NO_TYPENAME_WITH_CTOR ;
obj cxx11_unicode_literals : test_case.cpp : <define>TEST_BOOST_NO_CXX11_UNICODE_LITERALS ;
obj cxx11_unified_initialization_syntax : test_case.cpp : <define>TEST_BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX ;
obj cxx11_union_static_data : test_case.cpp : <define>TEST_BOOST_NO_CXX11_UNION_STATIC_DATA ;
obj cxx11_unrestricted_union : test_case.cpp : <define>TEST_BOOST_NO_CXX11_UNRESTRICTED_UNION ;
obj boost_function_scope_using_declaration_breaks_adl : test_case.cpp : <define>TEST_BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL ;
obj using_declaration_overloads_from_typename_base : test_case.cpp : <define>TEST_BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE ;
obj using_template : test_case.cpp : <define>TEST_BOOST_NO_USING_TEMPLATE ;

View File

@ -966,9 +966,9 @@
# error "Defect macro BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX is defined."
# endif
#endif
#ifdef TEST_BOOST_NO_CXX11_UNION_STATIC_DATA
# ifdef BOOST_NO_CXX11_UNION_STATIC_DATA
# error "Defect macro BOOST_NO_CXX11_UNION_STATIC_DATA is defined."
#ifdef TEST_BOOST_NO_CXX11_UNRESTRICTED_UNION
# ifdef BOOST_NO_CXX11_UNRESTRICTED_UNION
# error "Defect macro BOOST_NO_CXX11_UNRESTRICTED_UNION is defined."
# endif
#endif
#ifdef TEST_BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL

View File

@ -728,8 +728,9 @@ Unicode (`u8`, `u`, `U`) literals.
[[`BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX`][The compiler does not support
the [@http://en.wikipedia.org/wiki/C%2B%2B0x#Uniform_initialization C++11 Unified Initialization Syntax].
]]
[[`BOOST_NO_CXX11_UNION_STATIC_DATA`][The compiler does not support
a union with static data.
[[`BOOST_NO_CXX11_UNRESTRICTED_UNION`][The compiler does not support an unrestricted union. This is
a union that may contain static data as well as user-defined member data with non-trivial special
member functions.
]]
[[`BOOST_NO_CXX11_USER_DEFINED_LITERALS`][The compiler does not support user defined literals.
]]

View File

@ -199,7 +199,7 @@
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_FINAL
#define BOOST_NO_CXX11_THREAD_LOCAL
#define BOOST_NO_CXX11_UNION_STATIC_DATA
#define BOOST_NO_CXX11_UNRESTRICTED_UNION
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)

View File

@ -253,7 +253,7 @@
#endif
#if !__has_feature(cxx_unrestricted_unions)
# define BOOST_NO_CXX11_UNION_STATIC_DATA
# define BOOST_NO_CXX11_UNRESTRICTED_UNION
#endif
#if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__))

View File

@ -108,7 +108,7 @@
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_FINAL
#define BOOST_NO_CXX11_THREAD_LOCAL
#define BOOST_NO_CXX11_UNION_STATIC_DATA
#define BOOST_NO_CXX11_UNRESTRICTED_UNION
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)

View File

@ -220,7 +220,7 @@
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
#define BOOST_NO_CXX11_VARIADIC_MACROS
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
#define BOOST_NO_CXX11_UNION_STATIC_DATA
#define BOOST_NO_CXX11_UNRESTRICTED_UNION
#define BOOST_NO_SFINAE_EXPR
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
@ -294,7 +294,7 @@
#undef BOOST_NO_CXX11_USER_DEFINED_LITERALS
#undef BOOST_NO_CXX11_VARIADIC_MACROS
#undef BOOST_NO_CXX11_VARIADIC_TEMPLATES
#undef BOOST_NO_CXX11_UNION_STATIC_DATA
#undef BOOST_NO_CXX11_UNRESTRICTED_UNION
#undef BOOST_NO_SFINAE_EXPR
#undef BOOST_NO_TWO_PHASE_NAME_LOOKUP
#undef BOOST_MATH_DISABLE_STD_FPCLASSIFY

View File

@ -84,7 +84,7 @@
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_FINAL
#define BOOST_NO_CXX11_THREAD_LOCAL
#define BOOST_NO_CXX11_UNION_STATIC_DATA
#define BOOST_NO_CXX11_UNRESTRICTED_UNION
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)

View File

@ -270,7 +270,7 @@
// C++0x features in 5.1 and later
//
#if (BOOST_GCC_VERSION < 50100) || !defined(BOOST_GCC_CXX11)
# define BOOST_NO_CXX11_UNION_STATIC_DATA
# define BOOST_NO_CXX11_UNRESTRICTED_UNION
#endif
// C++14 features in 4.9.0 and later

View File

@ -62,7 +62,7 @@
# define BOOST_NO_CXX11_REF_QUALIFIERS
# define BOOST_NO_CXX11_FINAL
# define BOOST_NO_CXX11_THREAD_LOCAL
# define BOOST_NO_CXX11_UNION_STATIC_DATA
# define BOOST_NO_CXX11_UNRESTRICTED_UNION
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)

View File

@ -125,7 +125,7 @@
#define BOOST_NO_CXX11_INLINE_NAMESPACES
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_THREAD_LOCAL
#define BOOST_NO_CXX11_UNION_STATIC_DATA
#define BOOST_NO_CXX11_UNRESTRICTED_UNION
/*
See https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443331 and

View File

@ -505,9 +505,9 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {};
# undef BOOST_NO_CXX11_FINAL
#endif
// BOOST_NO_CXX11_UNION_STATIC_DATA
// BOOST_NO_CXX11_UNRESTRICTED_UNION
#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 50100)) && (!defined(_MSC_VER))
# undef BOOST_NO_CXX11_UNION_STATIC_DATA
# undef BOOST_NO_CXX11_UNRESTRICTED_UNION
#endif
#endif // defined(BOOST_INTEL_STDCXX0X)

View File

@ -127,7 +127,7 @@
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_FINAL
#define BOOST_NO_CXX11_THREAD_LOCAL
#define BOOST_NO_CXX11_UNION_STATIC_DATA
#define BOOST_NO_CXX11_UNRESTRICTED_UNION
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)

View File

@ -76,7 +76,7 @@
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_FINAL
#define BOOST_NO_CXX11_THREAD_LOCAL
#define BOOST_NO_CXX11_UNION_STATIC_DATA
#define BOOST_NO_CXX11_UNRESTRICTED_UNION
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)

View File

@ -89,7 +89,7 @@
# define BOOST_NO_CXX11_REF_QUALIFIERS
# define BOOST_NO_CXX11_FINAL
# define BOOST_NO_CXX11_THREAD_LOCAL
# define BOOST_NO_CXX11_UNION_STATIC_DATA
# define BOOST_NO_CXX11_UNRESTRICTED_UNION
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)

View File

@ -123,7 +123,7 @@
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
#define BOOST_NO_CXX11_INLINE_NAMESPACES
#define BOOST_NO_CXX11_FINAL
#define BOOST_NO_CXX11_UNION_STATIC_DATA
#define BOOST_NO_CXX11_UNRESTRICTED_UNION
#endif
#if (__SUNPRO_CC < 0x5140) || (__cplusplus < 201103)

View File

@ -138,7 +138,7 @@
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_FINAL
#define BOOST_NO_CXX11_THREAD_LOCAL
#define BOOST_NO_CXX11_UNION_STATIC_DATA
#define BOOST_NO_CXX11_UNRESTRICTED_UNION
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)

View File

@ -197,7 +197,7 @@
#endif
#if !__has_feature(cxx_unrestricted_unions)
# define BOOST_NO_CXX11_UNION_STATIC_DATA
# define BOOST_NO_CXX11_UNRESTRICTED_UNION
#endif
#if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__))

View File

@ -141,7 +141,7 @@
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_FINAL
#define BOOST_NO_CXX11_ALIGNAS
#define BOOST_NO_CXX11_UNION_STATIC_DATA
#define BOOST_NO_CXX11_UNRESTRICTED_UNION
#define BOOST_NO_CXX14_VARIABLE_TEMPLATES
#define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
#define BOOST_NO_CXX14_AGGREGATE_NSDMI

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 ] ;

View File

@ -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;
}
}

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;
}
}

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);

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())

View File

@ -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();
}

View File

@ -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();
}