0

While trying to make a smaller reproducible case from my code base, I reach the code below.

For me, it fails to compile with g++6.1 and boost 1.60 and boost develop.

The grammars and rules use default types for the skipper and the other bit and only specify the iterator and the signature. Is that the problem?

#include <iostream>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/support_istream_iterator.hpp>
#include <boost/phoenix.hpp>

namespace qis = boost::spirit::qi;
namespace pnx = boost::phoenix;
using qis::_r1; using qis::_r2;
using qis::_val;

template <typename Iterator>
struct G2 : public qis::grammar<Iterator, int(int)>
{
  G2()
  : G2::base_type(start_)
  {
    start_ %= qis::int_
    [
      pnx::if_( _r1 == 5 )
      [
        _val = 6
      ]
      .else_
      [       
        _val = 7
      ]
    ];
  }

  qis::rule<Iterator, int(int)> start_;  
};

template <typename Iterator>
struct G1 : public qis::grammar<Iterator, int(int)>
{
  G1()
    : G1::base_type(start_)
  {
    start_ %= g2_(_r1);
  }

  G2<Iterator> g2_;
  qis::rule<Iterator, int(int)> start_;
};

template <typename Iterator>
struct G : public qis::grammar<Iterator, int()>
{
  G()
    : G::base_type(start_)
  {
    int i;
    start_ %= g1_(i);
  }

  G1<Iterator> g1_;
  qis::rule<Iterator, int()> start_;
};


int main()
{
  G<boost::spirit::istream_iterator> g;

  return 0;
}
MMM
  • 910
  • 1
  • 9
  • 25
  • 1
    The first of the errors points to [this](https://github.com/boostorg/spirit/blob/develop/include/boost/spirit/home/qi/nonterminal/grammar.hpp#L72) (in your `G2`, probably caused by a typo). The errors in Boost.Phoenix are a consequence of that first error. – llonesmiz Jul 14 '16 at 14:04
  • indeed I had an attribute mismatch. I managed to make a small reproducible case, so I've edited the code above. Does it fail to compile for someone in c++11 boost>=1.60 ? – MMM Jul 15 '16 at 18:16

0 Answers0