Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile error when using error_handler together with x3::variant #750

Open
zhuoqiang opened this issue Jan 14, 2023 · 0 comments
Open

compile error when using error_handler together with x3::variant #750

zhuoqiang opened this issue Jan 14, 2023 · 0 comments

Comments

@zhuoqiang
Copy link

zhuoqiang commented Jan 14, 2023

not sure why but if used together with x3::variant in one compilation unit in g++ 11.3, there is a weird compile error:

boost/spirit/home/x3/support/ast/variant.hpp: In instantiation of 'struct boost::spirit::x3::variant<>':
/my/src/parser.hpp:173:33:   required from here
boost/spirit/home/x3/support/ast/variant.hpp:131:15: error: wrong number of template arguments (0, should be at least 1)
  131 |         using variant_type = boost::variant<Types...>;
      |               ^~~~~~~~~~~~

boost/variant/variant_fwd.hpp:282:53: note: provided for 'template<class T0, class ... TN> class boost::variant'
  282 | template < BOOST_VARIANT_AUX_DECLARE_PARAMS > class variant;
      |                                                     ^~~~~~~

could be workaround by change the error_reporting.hpp

// typedef typename std::iterator_traits<Iterator>::value_type char_type;
// std::basic_string<char_type> line{start, end};
std::string line{start, end}; //
err_out << x3::to_utf8(line) << std::endl;

or replace the std::endl to '\n'

typedef typename std::iterator_traits<Iterator>::value_type char_type;
std::string line{start, end};
err_out << x3::to_utf8(line) << '\n';

here I propose we replace the std::endl with '\n' to avoid hitting potential compile bug

zhuoqiang added a commit to zhuoqiang/spirit that referenced this issue Jan 14, 2023
workaroud boostorg#750 by replacing `std::endl` with `'\n'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant