Re: [Spirit Devel] ADAPT_ADT causes recursive grammars to not compile
Joel de Guzman <[email protected]> Fri, 19 Nov 2010 16:23:06 +0800
| Newsgroups | gmane.comp.parsers.spirit.devel |
|---|---|
| Message-ID | <[email protected]> |
On 11/19/2010 4:19 PM, Christopher Schmidt wrote:
> Robert Nelson schrieb:
>> Why does the following fail to compile?
>>
>> struct y
>> {
>> const std::vector<y>& get() const;
>> void set(const std::vector<y>&);
>> };
>>
>> BOOST_FUSION_ADAPT_ADT(y,(std::vector<y>,std::vector<y>,obj.get(),obj.set(val)))
>>
>> int main()
>> {
>> using namespace boost::spirit::qi;
>> using namespace boost::phoenix;
>> boost::spirit::qi::rule<std::string::const_iterator,y()> b;
>> b = (*b)[at_c<0>(_val) = _1]; //ERROR is here
>> }
>>
>> It seems to be a result of fusion loop unrolling or something. The
>> libraries don't like the fact we are parsing a vector of y's and storing
>> them in y. The above code works with seemingly slight modification, but
>> I need the above implementation in my application or a workaround.
>> Attached is main.cpp, a file with only the offending code and
>> three_main.cpp which has 2 other similar grammars, both of which will
>> compile. I think the error is the result of a bug/feature in the fusion
>> and/or spirit::qi library. Please help.
>>
>> Thanks
>> --Robert Nelson
>
> You forgot to include
>
> <boost/spirit/home/support/adapt_adt_attributes.hpp>
>
> Unfortunately that file has three bugs in it, which are fixed by the
> attached patch.
> Damn. I am sorry :( I do not really understand spirit, and so, at the
> time of adapting adapt_adt_attributes.hpp to the fusion changes, I just
> did a basic regex replace in adapt_adt_attributes. Then I ran Spirit's
> tests and fixed all compiling errors. These three bits of old code
> didn't trigger a compile error :(
> I do not know what to do. Hartmut, is there any chance to get this fix
> in 1.45? The code is definitely wrong, there is no
> fusion::extension::access::adt_attribute_proxy and the Const template
> type can definitely not be deduced.
>
> I apologize for the inconvenience.
If this is a real showstopper, you should ask one of the release
managers (e.g. Eric Niebler or Beman). I'm pretty sure this won't be
disruptive since this is new code.
Regards,
--
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev