3

I am using boost (1.77) spirit qi and lexer. The error handler expects a stream of characters but I am passing it a stream of tokens, resulting in garbled error messages.

I believe that the thread below points to a solution:

Boost.Spirit: Lex + Qi error reporting

In the comments there, @hkaiser writes:

Just an update: the example has been renamed in SVN to conjure2.

I just took a look at conjure2. In an attempt to understand what the program does, I open main.cpp and read the comments, all I find is this:

Not a calculator anymore, right? :-)

What is that supposed to mean?

I tried to compile the program and it fails with:

"error C2516: 'boost::phoenix::evaluator::impl<const Expr&, 
boost::phoenix::vector2boost::mpl::true_,
boost::phoenix::is_nullary,boost::proto::envns_::empty_env>::result_type': 
is not a legal base class"

What am I doing wrong?

  • Have you checked their bugtracking system? Sounds like a documentation bug to me. – Ulrich Eckhardt Dec 21 '21 at 10:37
  • "I tried to compile the program and it fails with" - how? – sehe Dec 21 '21 at 20:20
  • 1
    I tried myself and it start failing somewhere between boost 1.69 and 1.75; it's not a documentation bug but a bug probably introduced by a change in Phoenix or a utility library. It should be reported upstream. – sehe Dec 21 '21 at 22:24

1 Answers1

2

The fix is to put this at the top of lexer_def.hpp:

#include <boost/phoenix/operator.hpp>

That should define the missing expression template operators that prevent the lexer semantic actions from compiling.

sehe
  • 374,641
  • 47
  • 450
  • 633
  • 1
    Thanks for self-answering. I noticed your find on the mailing list. That was tricky to find, thanks for contributing! Maybe now you'll have enough "karma" (we call it reputation :)). Cheers – sehe Dec 24 '21 at 00:12
  • I am a refugee from reddit :) Thank you for confirming the problem on your side, Cheers – ixitzachitl Dec 24 '21 at 11:06