The following code produces a large compiler error along the lines of static assertion failed: Size of the passed attribute is less than expected.
:
constexpr x3::rule<struct Variable, ast::Variable> variable = "Variable";
const auto variable_def = +x3::alpha >> +x3::alnum;
BOOST_SPIRIT_DEFINE(variable);
where ast::Variable
is defined as struct Variable { std::string name_; }
.
However when surrounded by x3::raw[]
it compiles fine:
const auto variable_def = x3::raw[+x3::alpha >> +x3::alnum];
I would expect for +x3::alpha >> +x3::alnum
to collapse into a single std::string
according to the compound attribute rule:
a: vector<A>, b: vector<A> --> (a >> b): vector<A>
especially since const auto variable_def = +x3::alpha;
also compiles successfully.
Why is x3::raw[]
necessary for +x3::alpha >> +x3::alnum
?