Subject: [Boost-bugs] [Boost C++ Libraries] #5626: Compilation error when using boost::phoenix with range adaptors
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-06-21 15:33:36
#5626: Compilation error when using boost::phoenix with range adaptors
------------------------------------------------------+---------------------
Reporter: Nicolas Savoire <nicos@â¦> | Owner: theller
Type: Bugs | Status: new
Milestone: To Be Determined | Component: phoenix
Version: Boost Release Branch | Severity: Regression
Keywords: |
------------------------------------------------------+---------------------
The following piece of code fails to compile with gcc-4.5:
{{{
#include <iostream>
#include <boost/range.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/phoenix.hpp>
using namespace boost::phoenix::arg_names;
using namespace boost::adaptors;
int main()
{
std::cout << *boost::begin(boost::irange(0,5) | transformed( arg1 +1));
}
}}}
The error is:
{{{
In file included from /usr/local/mkt-
dev/src/boost_1_47_0_rc/boost/range/adaptor/transformed.hpp:16:0,
from /usr/local/mkt-
dev/src/boost_1_47_0_rc/boost/range/adaptor/map.hpp:14,
from /usr/local/mkt-
dev/src/boost_1_47_0_rc/boost/range/adaptors.hpp:20,
from test2.cpp:4:
/usr/local/mkt-
dev/src/boost_1_47_0_rc/boost/iterator/transform_iterator.hpp: In member
function âtypename boost::detail::transform_iterator_base<UnaryFunc,
Iterator, Reference, Value>::type::reference
boost::transform_iterator<UnaryFunction, Iterator, Reference,
Value>::dereference() const [with UnaryFunc =
boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal,
boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >, Iterator
= boost::range_detail::integer_iterator<int>, Reference =
boost::use_default, Value = boost::use_default, typename
boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference,
Value>::type::reference = int&]â:
/usr/local/mkt-
dev/src/boost_1_47_0_rc/boost/iterator/iterator_facade.hpp:517:32:
instantiated from âstatic typename Facade::reference
boost::iterator_core_access::dereference(const Facade&) [with Facade =
boost::transform_iterator<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal,
boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >,
boost::range_detail::integer_iterator<int>, boost::use_default,
boost::use_default>, typename Facade::reference = int&]â
/usr/local/mkt-
dev/src/boost_1_47_0_rc/boost/iterator/iterator_facade.hpp:643:67:
instantiated from âreference boost::iterator_facade<I, V, TC, R,
D>::operator*() const [with Derived =
boost::transform_iterator<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal,
boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >,
boost::range_detail::integer_iterator<int>, boost::use_default,
boost::use_default>, Value = int, CategoryOrTraversal =
boost::detail::iterator_category_with_traversal<std::input_iterator_tag,
boost::random_access_traversal_tag>, Reference = int&, Difference = long
int, reference = int&]â
test2.cpp:13:70: instantiated from here
/usr/local/mkt-
dev/src/boost_1_47_0_rc/boost/iterator/transform_iterator.hpp:121:31:
error: invalid initialization of reference of type âint&â from expression
of type âconst intâ
}}}
It seems that result_of<arg1(int)> returns int& instead of int.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5626> 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:06 UTC