Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6126: Signed integer members of Boost.Fusion adapted ADTs are not output correctly with Boost.Spirit.Karma rules
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-06 15:09:17
#6126: Signed integer members of Boost.Fusion adapted ADTs are not output
correctly with Boost.Spirit.Karma rules
-------------------------------+--------------------------------------------
Reporter: t0rt1e@⦠| Owner: hkaiser
Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
Version: Boost 1.48.0 | Severity: Regression
Resolution: | Keywords: patch proposed, Boost.Spirit.Karma, Boost.Fusion, BOOST_FUSION_ADAPT_CLASS, BOOST_FUSION_ADAPT_ADT, short, int, long
-------------------------------+--------------------------------------------
Comment (by t0rt1e@â¦):
Replying to [comment:17 hkaiser]:
> Replying to [comment:16 Seth Heeren <bugs@â¦>]:
> > Replying to [comment:15 hkaiser]:
> > >
> > > That's excellent news! Thanks. That allows to revert the patch
above.
[...]
> > Apart from specializing extract_from_attribute for adt_attribute_proxy
I don't see an easy way to resolve this. And I wouldn't think that this
approach is entirely trivial, either (it might be enough due to the
implicit conversion of the proxy to its exposed type?)
>
> Yep, that's what I think needs to be done, at least as a first step.
Since reimplementing the boost::rational getters to return by reference
instead by value isn't an option for me, I had a look to the Karma sources
to try Seth's suggestion. {{{extract_from_attribute}}} has been already
specialized for {{{adt_attribute_proxy}}} in
{{{boost/spirit/home/support/adapt_adt_attributes.hpp:192}}}. Commenting
out this specialization, will generate a compiler warning:
{{{
boost/spirit/home/karma/detail/extract_from.hpp:71:20: warning: returning
reference to local temporary object
return extract_from<Exposed>(fusion::at_c<0>(attr), ctx);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}}}
This also happens if the return {{{type}}} {{{typedef}}} is changed to
{{{fusion::extension::adt_attribute_proxy<T, N, Const>}}} in
{{{boost/spirit/home/support/adapt_adt_attributes.hpp:192}}} and the proxy
object is directly returned {{{call()}}} like suggested by Seth. I tried
to further follow the {{{extract_from}}} to see where the proxy gets
converted to a const ref to the contained type, but unfortunately got
lost. So, I'm stuck again.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6126#comment:19> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC