$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r74968 - trunk/boost
From: eric_at_[hidden]
Date: 2011-10-16 11:55:20
Author: eric_niebler
Date: 2011-10-16 11:55:19 EDT (Sun, 16 Oct 2011)
New Revision: 74968
URL: http://svn.boost.org/trac/boost/changeset/74968
Log:
fix regression on gcc-4.4
Text files modified: 
   trunk/boost/foreach.hpp |    31 +++++++++++++++++++++++++++++--         
   1 files changed, 29 insertions(+), 2 deletions(-)
Modified: trunk/boost/foreach.hpp
==============================================================================
--- trunk/boost/foreach.hpp	(original)
+++ trunk/boost/foreach.hpp	2011-10-16 11:55:19 EDT (Sun, 16 Oct 2011)
@@ -1052,22 +1052,49 @@
 
 namespace boost { namespace foreach_detail_
 {
+    template<typename Cond, typename T>
+    inline typename boost::mpl::if_<Cond, T const, T>::type &add_const_if(T &t)
+    {
+        return t;
+    }
+    
     template<typename T>
     typename remove_cv<typename decay<T>::type>::type decay_copy(T &&);
     
     template<typename T>
     T const add_const_if_rvalue(T &&);
 }}
-# define BOOST_FOREACH_AUTO_OBJECT(NAME, EXPR)                                                                    \
+
+#  define BOOST_FOREACH_IS_RVALUE(COL)                                                                           \
+    (true ? 0 : boost::foreach_detail_::is_rvalue(COL))
+
+# if (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ == 4) && !defined(BOOST_INTEL) && !defined(BOOST_CLANG))
+#  define BOOST_FOREACH_AUTO_OBJECT(NAME, EXPR)                                                                   \
+    if (bool BOOST_PP_CAT(NAME, _defined) = false) {} else                                                        \
+    for (auto NAME = (EXPR); !BOOST_PP_CAT(NAME, _defined); BOOST_PP_CAT(NAME, _defined) = true)
+# else
+#  define BOOST_FOREACH_AUTO_OBJECT(NAME, EXPR)                                                                   \
     if (bool BOOST_PP_CAT(NAME, _defined) = false) {} else                                                        \
     for (decltype(boost::foreach_detail_::decay_copy(EXPR)) NAME = (EXPR);                                        \
         !BOOST_PP_CAT(NAME, _defined); BOOST_PP_CAT(NAME, _defined) = true)
+# endif
 
 // If EXPR is an rvalue, bind it to a const rvalue reference.
-# define BOOST_FOREACH_AUTO_REF_REF(NAME, EXPR)                                                                   \
+# if (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ == 4) && !defined(BOOST_INTEL) && !defined(BOOST_CLANG))
+#  define BOOST_FOREACH_AUTO_REF_REF(NAME, EXPR)                                                                  \
+    if (bool BOOST_PP_CAT(NAME, _tmp_defined) = false) {} else                                                    \
+    for (auto &&BOOST_PP_CAT(NAME, _tmp) = (EXPR);                                                                \
+        !BOOST_PP_CAT(NAME, _tmp_defined); BOOST_PP_CAT(NAME, _tmp_defined) = true)                               \
+    if (bool BOOST_PP_CAT(NAME, _defined) = false) {} else                                                        \
+    for (auto &&NAME = boost::foreach_detail_::add_const_if< boost::is_rvalue_reference<decltype( (EXPR) ) &&> >( \
+            BOOST_PP_CAT(NAME, _tmp));                                                                            \
+        !BOOST_PP_CAT(NAME, _defined); BOOST_PP_CAT(NAME, _defined) = true)
+# else
+#  define BOOST_FOREACH_AUTO_REF_REF(NAME, EXPR)                                                                  \
     if (bool BOOST_PP_CAT(NAME, _defined) = false) {} else                                                        \
     for (decltype(boost::foreach_detail_::add_const_if_rvalue(EXPR)) &&NAME = (EXPR);                             \
         !BOOST_PP_CAT(NAME, _defined); BOOST_PP_CAT(NAME, _defined) = true)
+# endif
 
 #elif defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION)
 ///////////////////////////////////////////////////////////////////////////////