Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52869 - trunk/boost/spirit/home/support/iterators
From: hartmut.kaiser_at_[hidden]
Date: 2009-05-09 22:54:52


Author: hkaiser
Date: 2009-05-09 22:54:51 EDT (Sat, 09 May 2009)
New Revision: 52869
URL: http://svn.boost.org/trac/boost/changeset/52869

Log:
Spirit: Added a comment explaining the reason for a seemingless wrong initialization order.
Text files modified:
   trunk/boost/spirit/home/support/iterators/multi_pass.hpp | 18 ++++++++++++------
   1 files changed, 12 insertions(+), 6 deletions(-)

Modified: trunk/boost/spirit/home/support/iterators/multi_pass.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/multi_pass.hpp (original)
+++ trunk/boost/spirit/home/support/iterators/multi_pass.hpp 2009-05-09 22:54:51 EDT (Sat, 09 May 2009)
@@ -53,9 +53,21 @@
 
         multi_pass() : shared(0) {}
 
+ // Newer versions of gcc (and perhaps other compilers) are known to
+ // generate warnings about the base class and the 'shared' member
+ // being initialized in the wrong order ('shared' is initialized before
+ // the base class). This is fully intended behavior as some policies
+ // rely on the fact that their shared part is initialized before their
+ // unique part. Please ignore the warnings, these are harmless.
         explicit multi_pass(T input)
           : shared(new shared_data_type(input)), policies_base_type(input) {}
 
+ multi_pass(multi_pass const& x)
+ : shared(x.shared), policies_base_type(x)
+ {
+ policies_base_type::clone(*this);
+ }
+
 #if BOOST_WORKAROUND(__GLIBCPP__, == 20020514)
         // The standard library shipped with gcc-3.1 has a bug in
         // bits/basic_string.tcc. It tries to use iter::iter(0) to
@@ -74,12 +86,6 @@
             }
         }
 
- multi_pass(multi_pass const& x)
- : shared(x.shared), policies_base_type(x)
- {
- policies_base_type::clone(*this);
- }
-
         multi_pass& operator=(multi_pass const& x)
         {
             if (this != &x) {


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