Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63045 - trunk/libs/utility
From: nielsdekker_at_[hidden]
Date: 2010-06-17 12:53:55


Author: niels_dekker
Date: 2010-06-17 12:53:55 EDT (Thu, 17 Jun 2010)
New Revision: 63045
URL: http://svn.boost.org/trac/boost/changeset/63045

Log:
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
Text files modified:
   trunk/libs/utility/value_init_workaround_test.cpp | 29 +++++++++++++++++++++++++++--
   1 files changed, 27 insertions(+), 2 deletions(-)

Modified: trunk/libs/utility/value_init_workaround_test.cpp
==============================================================================
--- trunk/libs/utility/value_init_workaround_test.cpp (original)
+++ trunk/libs/utility/value_init_workaround_test.cpp 2010-06-17 12:53:55 EDT (Thu, 17 Jun 2010)
@@ -6,7 +6,7 @@
 //
 // 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".
 #define BOOST_DETAIL_VALUE_INIT_WORKAROUND 0
@@ -51,6 +51,30 @@
     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>
   bool is_value_initialized(const T(& arg)[2])
   {
@@ -107,7 +131,8 @@
   // TODO More types may be added later.
   const unsigned num_failures =
     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
   // One or more failures are expected.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk