Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61196 - trunk/libs/config/test
From: nielsdekker_at_[hidden]
Date: 2010-04-11 08:33:57


Author: niels_dekker
Date: 2010-04-11 08:33:56 EDT (Sun, 11 Apr 2010)
New Revision: 61196
URL: http://svn.boost.org/trac/boost/changeset/61196

Log:
Added value-initialization test to try to reproduce http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111

Text files modified:
   trunk/libs/config/test/boost_no_com_value_init.ipp | 10 ++++++++--
   1 files changed, 8 insertions(+), 2 deletions(-)

Modified: trunk/libs/config/test/boost_no_com_value_init.ipp
==============================================================================
--- trunk/libs/config/test/boost_no_com_value_init.ipp (original)
+++ trunk/libs/config/test/boost_no_com_value_init.ipp 2010-04-11 08:33:56 EDT (Sun, 11 Apr 2010)
@@ -301,7 +301,11 @@
   // of an empty set of parentheses, and allows checking whether
   // each of them is indeed value-initialized, as specified by
   // the C++ Standard ([dcl.init]).
- class value_initializer
+ //
+ // Note: its base class, int_struct, is there to try to reproduce GCC Bug 30111,
+ // "Value-initialization of POD base class doesn't initialize members",
+ // reported by Jonathan Wakely: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111
+ class value_initializer: int_struct
   {
   private:
     enum_holder m_enum_holder;
@@ -360,6 +364,7 @@
   public:
     value_initializer()
     :
+ int_struct(),
     m_enum_holder(),
     m_enum_holder_array(),
     m_enum(),
@@ -419,6 +424,7 @@
     unsigned check() const
     {
       const unsigned num_failures =
+ (IS_VALUE_INITIALIZED(data) ? 0 : 1) +
         (IS_VALUE_INITIALIZED(m_enum_holder) ? 0 : 1) +
         (IS_VALUE_INITIALIZED(m_enum_holder_array[0]) ? 0 : 1) +
         (IS_VALUE_INITIALIZED(m_enum_holder_array[1]) ? 0 : 1) +
@@ -525,7 +531,7 @@
     {
       std::cout << "Number of initialization failures on the stack: " << num_failures_on_stack
         << "\nNumber of initialization failures on the heap: " << num_failures_on_heap
- << "\nDetected by boost_no_complete_value_initialization::test() revision 8."
+ << "\nDetected by boost_no_complete_value_initialization::test() revision 9."
         << std::endl;
     }
     return static_cast<int>(num_failures_on_stack + num_failures_on_heap);


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