mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
Added test for private_int_array_pair, hoping to (possibly) fix a minion-clang/darwin-4.2.1 failure at boost.org/development/tests/trunk/developer/utility_.html
[SVN r63045]
This commit is contained in:
parent
9da96d9737
commit
b4a08fc80e
@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
// Test program for the boost::value_initialized<T> workaround.
|
// Test program for the boost::value_initialized<T> workaround.
|
||||||
//
|
//
|
||||||
// 30 May 2010 (Created) Niels Dekker
|
// 17 June 2010 (Created) Niels Dekker
|
||||||
|
|
||||||
// Switch the workaround off, before inluding "value_init.hpp".
|
// Switch the workaround off, before inluding "value_init.hpp".
|
||||||
#define BOOST_DETAIL_VALUE_INIT_WORKAROUND 0
|
#define BOOST_DETAIL_VALUE_INIT_WORKAROUND 0
|
||||||
@ -51,6 +51,30 @@ namespace
|
|||||||
return arg.i == 0;
|
return arg.i == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Equivalent to the Stats class from GCC Bug 33916,
|
||||||
|
// "Default constructor fails to initialize array members", reported in 2007 by
|
||||||
|
// Michael Elizabeth Chastain: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916
|
||||||
|
// and fixed for GCC 4.2.4.
|
||||||
|
class private_int_array_pair
|
||||||
|
{
|
||||||
|
friend bool is_value_initialized(const private_int_array_pair& arg);
|
||||||
|
private:
|
||||||
|
int first[12];
|
||||||
|
int second[12];
|
||||||
|
};
|
||||||
|
|
||||||
|
bool is_value_initialized(const private_int_array_pair& arg)
|
||||||
|
{
|
||||||
|
for ( unsigned i = 0; i < 12; ++i)
|
||||||
|
{
|
||||||
|
if ( (arg.first[i] != 0) || (arg.second[i] != 0) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool is_value_initialized(const T(& arg)[2])
|
bool is_value_initialized(const T(& arg)[2])
|
||||||
{
|
{
|
||||||
@ -107,7 +131,8 @@ int main()
|
|||||||
// TODO More types may be added later.
|
// TODO More types may be added later.
|
||||||
const unsigned num_failures =
|
const unsigned num_failures =
|
||||||
FAILED_TO_VALUE_INITIALIZE(boost::value_initialized<derived_struct>()) +
|
FAILED_TO_VALUE_INITIALIZE(boost::value_initialized<derived_struct>()) +
|
||||||
FAILED_TO_VALUE_INITIALIZE(boost::value_initialized<virtual_destructor_holder[2]>());
|
FAILED_TO_VALUE_INITIALIZE(boost::value_initialized<virtual_destructor_holder[2]>()) +
|
||||||
|
FAILED_TO_VALUE_INITIALIZE(boost::value_initialized<private_int_array_pair>());
|
||||||
|
|
||||||
#ifdef BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED
|
#ifdef BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED
|
||||||
// One or more failures are expected.
|
// One or more failures are expected.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user