Hi,
I'm using Boost 1.60 with Spirit X3 from develop branch (because it has this
fix
http://boost.2283326.n4.nabble.com/Single-element-attributes-in-X3-quot-stil...
).
If I change the rule from this:
auto a2 = rule{} = a1 >> a2_v2;
to this:
auto a2 = rule{} = a1 >> '(' >> a2_v2 >> ')';
it stops compiling (both gcc and clang) with error "no matching function
for call to 'move_to'".
Here is full source code:
#include
#include
#include
#include <string>
#include <vector>
namespace ast
{
BOOST_FUSION_DEFINE_STRUCT_INLINE
(
a1,
(std::string, v)
)
BOOST_FUSION_DEFINE_STRUCT_INLINE
(
a2,
(a1, v1)
(std::vector<double>, v2)
)
BOOST_FUSION_DEFINE_STRUCT_INLINE
(
a3,
(std::vector<a2>, v1)
)
}
using namespace boost::spirit::x3;
auto a0 = rule{} = lexeme[+alpha];
auto a1 = rule{} = a0;
auto a2_v2 = rule{} = -(double_ % ',');
auto a2 = rule{} = a1 >> '(' >> a2_v2
')';
//auto a2 = rule{} = a1 >> a2_v2;
auto a3_v1 = ruleast::a2>{} = *(a2 >> ';');
auto a3 = rule{} = a3_v1;
using data = ast::a3;
int main()
{
std::string script = "";
auto begin = script.begin();
auto end = script.end();
data v;
bool ok = (boost::spirit::x3::phrase_parse(begin, end, a3, space, v) &&
begin == end);
}
Here is how it is compiled:
#!/bin/bash
wget --no-clobber
http://netcologne.dl.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0...
tar -zxvf boost_1_60_0.tar.gz
wget --no-clobber https://github.com/boostorg/spirit/archive/develop.zip
unzip develop.zip
mv ./boost_1_60_0/boost/spirit ./boost_1_60_0/boost/spirit_old
g++ -std=c++14 test.cpp -I./spirit-develop/include/ -I./boost_1_60_0/ -o
test