Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55656 - in trunk: boost/proto/transform libs/proto/test
From: eric_at_[hidden]
Date: 2009-08-18 16:04:57


Author: eric_niebler
Date: 2009-08-18 16:04:56 EDT (Tue, 18 Aug 2009)
New Revision: 55656
URL: http://svn.boost.org/trac/boost/changeset/55656

Log:
fix proto::_value array handling under C++0x mode, fixes #3338
Text files modified:
   trunk/boost/proto/transform/arg.hpp | 3 ++-
   trunk/libs/proto/test/matches.cpp | 2 ++
   2 files changed, 4 insertions(+), 1 deletions(-)

Modified: trunk/boost/proto/transform/arg.hpp
==============================================================================
--- trunk/boost/proto/transform/arg.hpp (original)
+++ trunk/boost/proto/transform/arg.hpp 2009-08-18 16:04:56 EDT (Tue, 18 Aug 2009)
@@ -13,6 +13,7 @@
 #include <boost/proto/proto_fwd.hpp>
 #include <boost/proto/traits.hpp>
 #include <boost/proto/transform/impl.hpp>
+#include <boost/type_traits/is_array.hpp>
 #include <boost/proto/detail/suffix.hpp>
 
 namespace boost { namespace proto
@@ -196,7 +197,7 @@
             /// \return <tt>proto::value(e)</tt>
             /// \throw nothrow
             #ifdef BOOST_HAS_DECLTYPE
- result_type
+ typename mpl::if_c<is_array<result_type>::value, result_type &, result_type>::type
             #else
             typename result_of::value<typename impl::expr_param>::type
             #endif

Modified: trunk/libs/proto/test/matches.cpp
==============================================================================
--- trunk/libs/proto/test/matches.cpp (original)
+++ trunk/libs/proto/test/matches.cpp 2009-08-18 16:04:56 EDT (Tue, 18 Aug 2009)
@@ -172,6 +172,8 @@
     assert_matches< terminal<char [N]> >( as_child("hello") );
     assert_matches< terminal<char [N]> >( as_expr("hello") );
 
+ assert_not_matches< if_<is_same<_value, int>()> >( lit("hello") );
+
     assert_matches< terminal<std::string> >( lit(std::string("hello")) );
     assert_matches< terminal<std::string> >( as_child(std::string("hello")) );
     assert_matches< terminal<std::string> >( as_expr(std::string("hello")) );


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