Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2008-03-18 02:18:33


Author: eric_niebler
Date: 2008-03-18 02:18:33 EDT (Tue, 18 Mar 2008)
New Revision: 43695
URL: http://svn.boost.org/trac/boost/changeset/43695

Log:
work around gcc-4.0.1 bug with const-qualified function references
Text files modified:
   trunk/boost/xpressive/match_results.hpp | 14 +++++++++++---
   1 files changed, 11 insertions(+), 3 deletions(-)

Modified: trunk/boost/xpressive/match_results.hpp
==============================================================================
--- trunk/boost/xpressive/match_results.hpp (original)
+++ trunk/boost/xpressive/match_results.hpp 2008-03-18 02:18:33 EDT (Tue, 18 Mar 2008)
@@ -318,6 +318,14 @@
   : mpl::not_<is_function<T> >
 {};
 
+// work around gcc-4.0.1 compiler bug wrt function references
+template<typename T>
+typename mpl::if_<is_function<T>, T *, T const &>::type
+as_callable(T const &t)
+{
+ return t;
+}
+
 } // detail
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -857,7 +865,7 @@
       , mpl::size_t<1>
     ) const
     {
- return this->format2_(out, format(*this));
+ return this->format2_(out, detail::as_callable(format)(*this));
     }
 
     /// INTERNAL ONLY
@@ -871,7 +879,7 @@
       , mpl::size_t<2>
     ) const
     {
- return format(*this, out);
+ return detail::as_callable(format)(*this, out);
     }
 
     /// INTERNAL ONLY
@@ -885,7 +893,7 @@
       , mpl::size_t<3>
     ) const
     {
- return format(*this, out, flags);
+ return detail::as_callable(format)(*this, out, flags);
     }
 
     /// INTERNAL ONLY


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