Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53337 - trunk/boost/proto/detail
From: eric_at_[hidden]
Date: 2009-05-28 02:20:56


Author: eric_niebler
Date: 2009-05-28 02:20:55 EDT (Thu, 28 May 2009)
New Revision: 53337
URL: http://svn.boost.org/trac/boost/changeset/53337

Log:
fix macro argument reevaluation bugaboo
Text files modified:
   trunk/boost/proto/detail/decltype.hpp | 27 ++++++++++++++-------------
   1 files changed, 14 insertions(+), 13 deletions(-)

Modified: trunk/boost/proto/detail/decltype.hpp
==============================================================================
--- trunk/boost/proto/detail/decltype.hpp (original)
+++ trunk/boost/proto/detail/decltype.hpp 2009-05-28 02:20:55 EDT (Thu, 28 May 2009)
@@ -269,22 +269,22 @@
         }
 
         ////////////////////////////////////////////////////////////////////////////////////////////
- template<typename U, typename V>
- U *proto_get_pointer(V *, U *u)
+ template<typename U, typename V, typename T>
+ U *proto_get_pointer(T &t, V *, U *)
         {
- return u;
+ return boost::addressof(t);
         }
 
- template<typename U, typename V>
- U const *proto_get_pointer(V *, U const *u)
+ template<typename U, typename V, typename T>
+ U const *proto_get_pointer(T &t, V *, U const *)
         {
- return u;
+ return boost::addressof(t);
         }
 
- template<typename U, typename V>
- V *proto_get_pointer(V *v, ...)
+ template<typename U, typename V, typename T>
+ V *proto_get_pointer(T &t, V *, ...)
         {
- return v;
+ return get_pointer(t);
         }
 
         ////////////////////////////////////////////////////////////////////////////////////////////
@@ -293,9 +293,10 @@
         /**/
 
         #define BOOST_PROTO_GET_POINTER(Type, Obj) \
- boost::proto::detail::proto_get_pointer<typename boost::remove_reference<Type>::type>( \
- get_pointer(Obj) \
- , boost::addressof(boost::proto::detail::lvalue(Obj)) \
+ boost::proto::detail::proto_get_pointer<Type>( \
+ boost::proto::detail::lvalue(Obj) \
+ , (true ? 0 : get_pointer(Obj)) \
+ , (true ? 0 : boost::addressof(boost::proto::detail::lvalue(Obj))) \
         ) \
         /**/
 
@@ -460,7 +461,7 @@
               : obj(t)
               , pmf(p)
             {}
-
+
             result_type operator()() const
             {
                 BOOST_PROTO_USE_GET_POINTER();


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