Boost logo

Proto :

Subject: [proto] Compiles under Boost 1.42 but not under 1.44
From: Hossein Haeri (powerprogman_at_[hidden])
Date: 2011-02-17 13:46:25


Dear all,

I have a piece of code that compiles under the Proto of Boost 1.42 but doesn't compile under that of Boost 1.44! Here is the error message that I get under GCC 4.5.1 (MinGW32, WinXP, SP3):

main.cpp: In function 'int main()':
main.cpp:73:3: error: no match for 'operator>>' in 'EW1<InpPool, GameState, KillMsg>() >> plus1'
main.cpp:73:3: error: template argument 1 is invalid
main.cpp:73:3: error: invalid type in declaration before ';' token
main.cpp:73:3: error: no match for 'operator>>' in 'EW1<InpPool, GameState, KillMsg>() >> plus1'
main.cpp:73:3: error: template argument 1 is invalid
main.cpp:73:3: error: invalid type in declaration before '(' token
main.cpp:73:3: error: no match for 'operator>>' in 'EW1<InpPool, GameState, KillMsg>() >> plus1'
main.cpp:81:14: error: request for member 'value' in 'e1', which is of non-class type 'int'

I have also left a minimal portion of my code in the P.S. Here is a short recap on my special syntax:

* x >> &f >> &g to have the value of g(f(x)). And,
* (x || y) >> &f to have the value of f(x, y).

Any idea please?

TIA,
--Hossein

P.S.

template<typename> struct EmtnExpr;

struct EmtnDom:
boost::proto::domain<boost::proto::generator<EmtnExpr>, EmtnGram> {};

template<typename Expr>
struct EmtnExpr:
  boost::proto::extends<Expr, EmtnExpr<Expr>, EmtnDom>
{
  explicit EmtnExpr(const Expr& expr):
    boost::proto::extends<Expr, EmtnExpr<Expr>, EmtnDom>(expr)
  {}
};

BOOST_PROTO_DEFINE_OPERATORS(IsEmtnStarter, EmtnDom)

template<typename Expr>
class Emtn
{
public:
  typedef Expr passed_formula_type;
  typedef typename boost::proto::result_of::deep_copy<Expr>::type stored_formula_type;

  Emtn(const Expr& e): impl_(boost::proto::deep_copy(e))
  {
    //Some grammar checks with BOOST_MPL_ASSERT_MSG
  }

  stored_formula_type formula() const {return impl_.formula_;}

  //Some other member functions...
private:
  template<typename T>
  struct Impl
  {
    Impl(T t): formula_(t) {}
  private:
    friend class Emtn;

    //few member functions...

    const T formula_;
  };

  const Impl<stored_formula_type> impl_;
};

#define DEFINE_EMTN(name, exp) \
  typedef Emtn<BOOST_TYPEOF(exp)> name##_type; \
  Emtn<BOOST_TYPEOF(exp)> name(exp)

double plus1(double d) {return d + 1;}

int main()
{
...
  DEFINE_EMTN(e1, EW1<InpPool, GameState, KillMsg>() >> &plus1);
...
}


Proto list run by eric at boostpro.com