Subject: [Boost-bugs] [Boost C++ Libraries] #2429: raw[] attribute incompatibility
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-10-22 16:28:59
#2429: raw[] attribute incompatibility
-------------------------------------------+--------------------------------
Reporter: vallentin_at_[hidden] | Owner: djowel
Type: Bugs | Status: new
Milestone: Boost 1.37.0 | Component: spirit
Version: Boost 1.36.0 | Severity: Problem
Keywords: raw, attribute, compatibility |
-------------------------------------------+--------------------------------
I discovered an issue with the raw[] parser returning an
iterator_range<T>.
While it should be compatible to std::string, it is not according to my
experience. Below, I attached an excerpt from the mailing list that
captures the
problem pretty well.
On Tue, Oct 21, 2008 at 09:04:48AM +0800, Joel de Guzman wrote:
> First, std::string should be compatible with iterator pair, so it should
> just be:
>
> raw["foo"][_val = _1]
This was in fact my first choice but did not compile with several g++
versions [1]:
> Or simply:
>
> r %= raw["foo"];
Unlike the explicit above version, this works. This primarily drives my
confusion. However, in my more complex grammar I cannot use this
convenient approach.
> But, if you really need to get at the first/last, since
boost::iterator_range
> is a valid STL sequence, you can simply use:
>
> construct<std::string>(begin(_1),end(_1))
>
> begin and end are phoenix functions in the stl/container module.
Interestingly replacing boost::phoenix::at_c<0>(_1) with begin(_1) /
end(_1)
works and compiles.
I attached my test file, hoping you can reproduce the error as well.
Best,
Matthias
[1] Compiler errors:
a) i686-apple-darwin9-g++-4.0.1 (died):
---------------------------------------
***/boost-1_36/boost/spirit/home/phoenix/operator/self.hpp:27: error: no
match for âoperator=â in
âboost::phoenix::result_of_assign<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, const
boost::iterator_range<__gnu_cxx::__normal_iterator<const char*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> > >
>&>::x = boost::phoenix::result_of_assign<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, const
boost::iterator_range<__gnu_cxx::__normal_iterator<const char*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> > >
>&>::yâ
/usr/include/c++/4.0.0/bits/basic_string.h:479: note: candidates are:
std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT,
_Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits,
_Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc =
std::allocator<char>]
/usr/include/c++/4.0.0/bits/basic_string.h:487: note:
std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT,
_Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char, _Traits =
std::char_traits<char>, _Alloc = std::allocator<char>]
/usr/include/c++/4.0.0/bits/basic_string.h:498: note:
std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT,
_Traits, _Alloc>::operator=(_CharT) [with _CharT = char, _Traits =
std::char_traits<char>, _Alloc = std::allocator<char>]
i686-apple-darwin9-g++-4.0.1: Internal error: Segmentation fault (program
cc1plus)
Please submit a full bug report.
See <URL:http://developer.apple.com/bugreporter> for instructions.
b) Target: i386-apple-darwin9.5.0 (g++ version 4.3.2)
-----------------------------------------------------
***/boost-1_36/boost/spirit/home/phoenix/operator/self.hpp:27: error:
'(((long unsigned
int)boost::phoenix::result_of_assign<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, const
boost::iterator_range<__gnu_cxx::__normal_iterator<const char*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> > >
>&>::size) + 4294967295ul)' is not a valid template argument for type
'long
int' because it is a non-constant expression
[...]
***/boost-1_36/boost/spirit/home/support/detail/action_dispatch.hpp:37:
error: no match for call to '(const
boost::phoenix::actor<boost::phoenix::composite<boost::phoenix::assign_eval
, boost::fusion::vector<boost::spirit::attribute<0>,
boost::spirit::argument<0>, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_> > >)
(const boost::fusion::vector<const
boost::iterator_range<__gnu_cxx::__normal_iterator<const char*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> > >
>&, 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_>,
boost::fusion::vector<boost::fusion::vector<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, 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_>,
boost::fusion::vector<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_, 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_>&, bool&)'
***/boost-1_36/boost/spirit/home/phoenix/core/actor.hpp:91: note:
candidates are: typename boost::mpl::eval_if<typename Eval::no_nullary,
boost::mpl::identity<boost::phoenix::detail::error_expecting_arguments>,
boost::phoenix::eval_result<Eval,
boost::phoenix::basic_environment<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_, boost::fusion::void_> >
>::type
boost::phoenix::actor<Eval>::operator()() const [with Eval =
boost::phoenix::composite<boost::phoenix::assign_eval,
boost::fusion::vector<boost::spirit::attribute<0>,
boost::spirit::argument<0>, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_> >]
-- Ticket URL: <http://svn.boost.org/trac/boost/ticket/2429> 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:49:59 UTC