Initialize your any!
boost::any var = 0;
Spirit binds the attribute value by reference, so it will cast to int&
before invoking the qi::int_
parser.
On a side note, using boost::any
with Spirit seems like misguided plan. I can't see why you'd diverge from statically known types and e.g. Variant. But I'll leave that up to you :)
P.S. Oh, and you forgot some more parentheses like here :). See it Live On Coliru now