Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67284 - in trunk: boost/proto/transform libs/proto/test
From: eric_at_[hidden]
Date: 2010-12-17 13:22:54


Author: eric_niebler
Date: 2010-12-17 13:22:52 EST (Fri, 17 Dec 2010)
New Revision: 67284
URL: http://svn.boost.org/trac/boost/changeset/67284

Log:
fix gcc workaround for noinvoke
Text files modified:
   trunk/boost/proto/transform/make.hpp | 32 +++++++++++++++++++++++++-------
   trunk/libs/proto/test/noinvoke.cpp | 35 +++++++++++++++++++++++++++++++++++
   2 files changed, 60 insertions(+), 7 deletions(-)

Modified: trunk/boost/proto/transform/make.hpp
==============================================================================
--- trunk/boost/proto/transform/make.hpp (original)
+++ trunk/boost/proto/transform/make.hpp 2010-12-17 13:22:52 EST (Fri, 17 Dec 2010)
@@ -338,7 +338,9 @@
                 BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
               , typename Expr, typename State, typename Data
>
- struct make_<R<BOOST_PP_ENUM_PARAMS(N, A)>, Expr, State, Data
+ struct make_<
+ R<BOOST_PP_ENUM_PARAMS(N, A)>
+ , Expr, State, Data
                 BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(N)
>
               : nested_type_if<
@@ -353,8 +355,10 @@
                 BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
               , typename Expr, typename State, typename Data
>
- struct make_<noinvoke<R<BOOST_PP_ENUM_PARAMS(N, A)> >, Expr, State, Data
- BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(N)
+ struct make_<
+ noinvoke<R<BOOST_PP_ENUM_PARAMS(N, A)> >
+ , Expr, State, Data
+ BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(1)
>
             {
                 typedef R<BOOST_PP_ENUM(N, TMP1, ~)> type;
@@ -371,8 +375,15 @@
                 BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
               , typename Expr, typename State, typename Data
>
- struct make_if_<R(BOOST_PP_ENUM_PARAMS(N, A)), Expr, State, Data, CT_not_callable>
- : uncvref<typename when<_, R(BOOST_PP_ENUM_PARAMS(N, A))>::template impl<Expr, State, Data>::result_type>
+ struct make_if_<
+ R(BOOST_PP_ENUM_PARAMS(N, A))
+ , Expr, State, Data
+ , CT_not_callable
+ >
+ : uncvref<
+ typename when<_, R(BOOST_PP_ENUM_PARAMS(N, A))>
+ ::template impl<Expr, State, Data>::result_type
+ >
             {
                 static bool const applied = true;
             };
@@ -382,8 +393,15 @@
                 BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
               , typename Expr, typename State, typename Data
>
- struct make_if_<R(*)(BOOST_PP_ENUM_PARAMS(N, A)), Expr, State, Data, CT_not_callable>
- : uncvref<typename when<_, R(BOOST_PP_ENUM_PARAMS(N, A))>::template impl<Expr, State, Data>::result_type>
+ struct make_if_<
+ R(*)(BOOST_PP_ENUM_PARAMS(N, A))
+ , Expr, State, Data
+ , CT_not_callable
+ >
+ : uncvref<
+ typename when<_, R(BOOST_PP_ENUM_PARAMS(N, A))>
+ ::template impl<Expr, State, Data>::result_type
+ >
             {
                 static bool const applied = true;
             };

Modified: trunk/libs/proto/test/noinvoke.cpp
==============================================================================
--- trunk/libs/proto/test/noinvoke.cpp (original)
+++ trunk/libs/proto/test/noinvoke.cpp 2010-12-17 13:22:52 EST (Fri, 17 Dec 2010)
@@ -43,6 +43,32 @@
>
 {};
 
+template<typename T, typename U>
+struct select2nd
+{
+ typedef U type;
+};
+
+struct Test3
+ : proto::when<
+ _
+ // This add_pointer gets invoked because a substitution takes place
+ // within it.
+ , select2nd<
+ void
+ , proto::noinvoke<
+ // This remove_pointer invocation is bloked by noinvoke
+ select2nd<
+ void
+ // This add_pointer invocation is *not* blocked by noinvoke
+ , boost::add_pointer<_>
+ >
+ >
+ >()
+ >
+{};
+
+
 void test_noinvoke()
 {
     typedef proto::terminal<int>::type Int;
@@ -65,6 +91,15 @@
     ));
     
     boost::remove_pointer<Int *> * t2 = Test2()(i);
+
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::result_of<Test3(Int)>::type
+ , select2nd<void, Int *>
+ >
+ ));
+
+ select2nd<void, Int *> t3 = Test3()(i);
 }
 
 using namespace boost::unit_test;


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