title: boost spirit v2 compile error - trying to use symbols for something slightly harder and missing an important point somewhere
body: <p>I have tried various approaches to fixing this issue with maps and casts, splitting the parse into different sub-pieces, using std::vector directly and trying _r1 etc. but I seem to have failed to grasp something fundamental about the use of attributes.</p>
  
  <p>I want to parse a line such as:</p>
  
  <pre><code>DEFMACRO macroname param1 param2 param3 ... paramN
  </code></pre>
  
  <p>and add macroname into a qi::symbols parser along with its list of params.</p>
  
  <p>Matching on </p>
  
  <pre><code>lit("DEFMACRO") &gt;&gt; (+char_) &gt;&gt; predicate_
  </code></pre>
  
  <p>and putting into a defmacro struct works fine, but when I try to use the result or store it whole as the data element of a symbols parser I get errors of the form </p>
  
  <p>cannot convert from 'const boost::phoenix::actor' to 'const client::defmacro'</p>
  
  <ul>
  <li>but whatever I try I always fail to "convert from 'const boost::phoenix::actor' to" whatever data type I am trying to use (eg straight to std::vector or other variations in structs. Also tried variations on syntax but so far drawn a blank.</li>
  </ul>
  
  <p>Code fragment is below, followed by compiler output for this variation on my problem.</p>
  
  <p>Any explanation of my failure to grasp some important concept very welcome.</p>
  
  <p>Using VC++ 2008 with Spirit 1.42.</p>
  
  <p>Thanks
  Rick</p>
  
  <pre><code>#include &lt;boost/spirit/include/qi.hpp&gt;
  #include &lt;boost/spirit/include/qi_int.hpp&gt;
  #include &lt;boost/spirit/include/phoenix_core.hpp&gt;
  #include &lt;boost/spirit/include/phoenix_operator.hpp&gt;
  #include &lt;boost/spirit/include/phoenix_fusion.hpp&gt;
  #include &lt;boost/spirit/include/phoenix_stl.hpp&gt;
  #include &lt;boost/spirit/include/phoenix_object.hpp&gt;
  #include &lt;boost/fusion/include/adapt_struct.hpp&gt;
  
  #include &lt;string&gt;
  #include &lt;vector&gt;
  
  namespace client
  {
      namespace fusion = boost::fusion;
      namespace phoenix = boost::phoenix;
      namespace qi = boost::spirit::qi;
      namespace ascii = boost::spirit::ascii;
  
   typedef std::vector&lt;std::string&gt; predicate;
  
   struct defmacro
      {
    std::string name;  // identifier for macro
    predicate params;  // parameters for macro
      };
  
  }
  
  BOOST_FUSION_ADAPT_STRUCT(
      client::defmacro,
      (std::string, name)
   (client::predicate, params)
  )
  
  namespace client
  {
      template &lt;typename Iterator&gt;
      struct awe_grammar
        : qi::grammar&lt;Iterator, awe(), qi::locals&lt;std::string&gt;, ascii::space_type&gt;
      {
          awe_grammar()
            : awe_grammar::base_type(x, "x")
          {
              using qi::lit;
              using qi::eol;
              using qi::int_;
              using ascii::char_;
              using namespace qi::labels;
  
              using phoenix::at_c;
  
     long line_no=1;
     qi::symbols&lt;std::string,  defmacro&gt; macros;
  
     eol_ = eol[ref(line_no)++];
  
     predicate_ %= *(+char_); 
  
     defmacro_line_ %= (lit("DEFMACRO") &gt;&gt; (+char_) &gt;&gt; predicate_ &gt;&gt; eol_);
  
     // ******** This line will not compile *************************
     defmacro_  = defmacro_line_[macros.add(at_c&lt;0&gt;(_1),_1)];
     // *************************************************************
          }
  
    qi::rule&lt;Iterator, defmacro(), ascii::space_type&gt; defmacro_line_;
    qi::rule&lt;Iterator, void(), ascii::space_type&gt; defmacro_;
          qi::rule&lt;Iterator, predicate(), ascii::space_type&gt; predicate_;
  
   };
  }
  
  2&gt;v:\awe\parser\parser\spirit\spirit_eg.cpp(XXX) : error C2664: 'const boost::spirit::qi::symbols&lt;Char,T&gt;::adder &amp;boost::spirit::qi::symbols&lt;Char,T&gt;::adder::operator ()&lt;boost::phoenix::actor&lt;Eval&gt;&gt;(const Str &amp;,const T &amp;) const' : cannot convert parameter 2 from 'const boost::phoenix::actor&lt;Eval&gt;' to 'const client::defmacro &amp;'
  2&gt;        with
  2&gt;        [
  2&gt;            Char=std::string,
  2&gt;            T=client::defmacro,
  2&gt;            Eval=boost::phoenix::composite&lt;boost::phoenix::at_eval&lt;0&gt;,boost::fusion::vector&lt;boost::spirit::argument&lt;0&gt;,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_&gt;&gt;,
  2&gt;            Str=boost::phoenix::actor&lt;boost::phoenix::composite&lt;boost::phoenix::at_eval&lt;0&gt;,boost::fusion::vector&lt;boost::spirit::argument&lt;0&gt;,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_,boost::fusion::void_&gt;&gt;&gt;
  2&gt;        ]
  2&gt;        and
  2&gt;        [
  2&gt;            Eval=boost::spirit::argument&lt;0&gt;
  2&gt;        ]
  2&gt;        Reason: cannot convert from 'const boost::phoenix::actor&lt;Eval&gt;' to 'const client::defmacro'
  2&gt;        with
  2&gt;        [
  2&gt;            Eval=boost::spirit::argument&lt;0&gt;
  2&gt;        ]
  2&gt;        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
  2&gt;        v:\awe\parser\parser\spirit\spirit_eg.cpp(351) : while compiling class template member function 'client::awe_grammar&lt;Iterator&gt;::awe_grammar(void)'
  2&gt;        with
  2&gt;        [
  2&gt;            Iterator=std::_String_const_iterator&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt;&gt;
  2&gt;        ]
  2&gt;        v:\awe\parser\parser\spirit\spirit_eg.cpp(622) : see reference to class template instantiation 'client::awe_grammar&lt;Iterator&gt;' being compiled
  2&gt;        with
  2&gt;        [
  2&gt;            Iterator=std::_String_const_iterator&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt;&gt;
  2&gt;        ]
  </code></pre>