1

This code is from the examples for boost spirit libs, it's OK:

on_error<fail>(expr,error_handler_function(eh)("expecting ", _4, _3));

However, this code failed to compile in Xcode:

on_error<fail>(expr,error_handler_function(eh)("expecting ", _4, _3, _1)); 

The error message:

/usr/local/include/boost/spirit/home/phoenix/core/detail/function_eval.hpp:115:30:
    error: too many template arguments for class template 'result'

    fn::template result<BOOST_PP_ENUM_PARAMS(N, a)>
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

The eh(error_handle) is right, I added the argument for the _1.

Austin Mullins
  • 7,307
  • 2
  • 33
  • 48
Matazure
  • 43
  • 4
  • Don't just _claim_ "The `eh(error_handle)` is right", show it! It's essential to the error (and, one might say, it's obviously not right :)) – sehe Jul 24 '14 at 08:25

1 Answers1

3

You added the argument, but failed to add a template argument.

It needs to be a template argument because Phoenix expects fully polymorphic functors.


Potentially (depending on compiler and library versions), you can remove some of the restrictions by using

#define BOOST_SPIRIT_USE_PHOENIX_V3
// and/or
#define BOOST_RESULT_OF_USE_DECLTYPE
sehe
  • 374,641
  • 47
  • 450
  • 633