Ticket #12349: spirit_test.cpp

File spirit_test.cpp, 948 bytes (added by juanpablo.canepa@…, 5 years ago)

Reduced gramar that fails to build with boost 1.63 / gcc 6.2

Line 
1#include <boost/spirit/include/qi.hpp>
2#include <boost/spirit/include/phoenix.hpp>
3#include <boost/fusion/container.hpp>
4#include <boost/fusion/include/container.hpp>
5
6struct SomeState
7{
8};
9
10namespace qi = boost::spirit::qi;
11
12/*
13 * Prototype of the grammar where the error is appearing
14 */
15template <typename Iterator>
16struct CommandsGrammar: boost::spirit::qi::grammar<Iterator, SomeState(SomeState)>
17{
18 CommandsGrammar()
19 : CommandsGrammar::base_type(commands)
20 {
21 commands =
22 (
23 "subcommand1"
24 | ( "subcommand2" > qi::uint_)
25 | ( qi::uint_ > qi::uint_ > qi::uint_ > qi::uint_ )
26 )[qi::_val = qi::_r1];
27 }
28
29 qi::rule<Iterator, SomeState(SomeState)> commands;
30};
31
32/* Explicit instantiation of the template to show that the problem
33 * occurs just in the grammar itself */
34template CommandsGrammar<std::string::iterator>::CommandsGrammar();
35
36int main()
37{
38
39}