I'm trying to compile the following seemingly simple code using GCC 3.4.6 and Boost 1.43 and it's generating an internal compiler error:
#include <string>
#include <boost/spirit/include/lex_lexertl.hpp>
#include <boost/spirit/include/qi.hpp>
namespace lex = boost::spirit::lex;
namespace qi = boost::spirit::qi;
typedef lex::lexertl::token<std::string::iterator> TokenT;
typedef lex::lexertl::actor_lexer<TokenT> LexerT;
template <typename LexerT>
struct Tokens: public lex::lexer<LexerT>
{};
int main()
{
typedef Tokens<LexerT>::iterator_type IteratorT;
qi::rule<IteratorT, int> expression;
expression = (qi::int_ >> qi::int_) [ qi::_val = qi::_1 ];
}
The generated error:
.../boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:83: internal compiler error: in lookup_member, at cp/search.c:1300
The last line in main() is generating this error. This error goes away by either letting the expression rule work on an std::string::iterator instead of IteratorT.
Any help with fixing the error while still working with a lexer is much appreciated.
Thanks!
You missed the parens:
This might fix the compile error (allthough I can't check, since both gcc, clang and msvc happily compiled it)
You may want to reduce the compiler stress:
Possibly more in that region.
LIMITS
I did a simple
to get a list of possible defines, and based a following change on it:
Now, the following size changes happen (in LoC preprocessed):
basically, a >10% reduction in code lines. It just might help.