Subject: [Boost-bugs] [Boost C++ Libraries] #10785: Lambda assignment fails to compile in 1.57.0
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-11-12 09:50:58
#10785: Lambda assignment fails to compile in 1.57.0
------------------------------+---------------------------
Reporter: dolfim@⦠| Owner: no-maintainer
Type: Bugs | Status: new
Milestone: To Be Determined | Component: lambda
Version: Boost 1.57.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------
The following code used to work. From Boost 1.57.0 it does not compile
with Clang 3.4, 3.5, 3.6 and Apple Clang.
{{{
#!c++
#include <iostream>
#include <boost/function.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
int add(int a, int b) {
return a+b;
}
int main() {
boost::function<int (int, int)> fuse = boost::lambda::bind(&add,
boost::lambda::_1, -boost::lambda::_2);
int a = fuse(3,6);
std::cout << a << std::endl;
}
}}}
The compiler error reads:
{{{
In file included from boost_lambda.cpp:3:
In file included from
/Users/dolfim/src/boost_1_57_0/boost/lambda/lambda.hpp:14:
In file included from
/Users/dolfim/src/boost_1_57_0/boost/lambda/core.hpp:46:
/Users/dolfim/src/boost_1_57_0/boost/lambda/detail/lambda_traits.hpp:256:58:
error: cannot form a reference to 'void'
typename detail::IF<boost::is_function<T>::value, T&, const T>::RET
^
/Users/dolfim/src/boost_1_57_0/boost/lambda/detail/operators.hpp:148:98:
note: in instantiation of template class
'boost::lambda::const_copy_argument<const void>' requested here
BOOST_LAMBDA_BE2(BOOST_LAMBDA_COMMA_OPERATOR_NAME,
other_action<comma_action>, const A, const B, const_copy_argument)
^
/Users/dolfim/src/boost_1_57_0/boost/lambda/detail/operators.hpp:63:20:
note: expanded from macro 'BOOST_LAMBDA_BE2'
tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> >
\
^
/Users/dolfim/src/boost_1_57_0/boost/lambda/detail/operators.hpp:148:18:
note: while substituting deduced template arguments into
function template 'operator,' [with A = void, Arg =
boost::lambda::lambda_functor_base<boost::lambda::action<3,
boost::lambda::function_action<3,
boost::lambda::detail::unspecified> >, boost::tuples::tuple<int
(*const)(int, int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<FIRST> >,
const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::unary_arithmetic_action<boost::lambda::minus_action>,
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<SECOND>
>, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> >]
BOOST_LAMBDA_BE2(BOOST_LAMBDA_COMMA_OPERATOR_NAME,
other_action<comma_action>, const A, const B, const_copy_argument)
^
/Users/dolfim/src/boost_1_57_0/boost/lambda/detail/operators.hpp:145:42:
note: expanded from macro
'BOOST_LAMBDA_COMMA_OPERATOR_NAME'
#define BOOST_LAMBDA_COMMA_OPERATOR_NAME operator,
^
/Users/dolfim/src/boost_1_57_0/boost/lambda/detail/operators.hpp:65:78:
note: expanded from macro 'BOOST_LAMBDA_BE2'
>
\
^
/Users/dolfim/src/boost_1_57_0/boost/type_traits/is_copy_constructible.hpp:104:24:
note: in instantiation of template class
'boost::detail::is_copy_constructible_impl2<false,
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<3,
boost::lambda::function_action<3,
boost::lambda::detail::unspecified> >, boost::tuples::tuple<int
(*const)(int, int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<FIRST> >,
const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::unary_arithmetic_action<boost::lambda::minus_action>,
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<SECOND>
>, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> > > >' requested here
boost::detail::is_copy_constructible_impl2<
^
/Users/dolfim/src/boost_1_57_0/boost/config/suffix.hpp:394:72: note:
expanded from macro 'BOOST_STATIC_CONSTANT'
# define BOOST_STATIC_CONSTANT(type, assignment) static const type
assignment
^
/Users/dolfim/src/boost_1_57_0/boost/type_traits/is_copy_constructible.hpp:113:71:
note: in instantiation of template class
'boost::detail::is_copy_constructible_impl<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<3,
boost::lambda::function_action<3,
boost::lambda::detail::unspecified> >, boost::tuples::tuple<int
(*const)(int, int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<FIRST> >,
const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::unary_arithmetic_action<boost::lambda::minus_action>,
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<SECOND>
>, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> > > >' requested here
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_copy_constructible,T,::boost::detail::is_copy_constructible_impl<T>::value)
^
/Users/dolfim/src/boost_1_57_0/boost/type_traits/detail/bool_trait_def.hpp:61:30:
note: expanded from macro
'BOOST_TT_AUX_BOOL_TRAIT_DEF1'
BOOST_TT_AUX_BOOL_C_BASE(C) \
^
/Users/dolfim/src/boost_1_57_0/boost/type_traits/detail/bool_trait_def.hpp:55:81:
note: expanded from macro
'BOOST_TT_AUX_BOOL_C_BASE'
# define BOOST_TT_AUX_BOOL_C_BASE(C) : public
::boost::integral_constant<bool,C>
^
/Users/dolfim/src/boost_1_57_0/boost/type_traits/has_trivial_copy.hpp:36:76:
note: in instantiation of template class
'boost::is_copy_constructible<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<3,
boost::lambda::function_action<3,
boost::lambda::detail::unspecified> >, boost::tuples::tuple<int
(*const)(int, int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<FIRST> >,
const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::unary_arithmetic_action<boost::lambda::minus_action>,
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<SECOND>
>, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> > > >' requested here
BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T) &&
boost::is_copy_constructible<T>::value);
^
/Users/dolfim/src/boost_1_57_0/boost/config/suffix.hpp:394:72: note:
expanded from macro 'BOOST_STATIC_CONSTANT'
# define BOOST_STATIC_CONSTANT(type, assignment) static const type
assignment
^
/Users/dolfim/src/boost_1_57_0/boost/type_traits/has_trivial_copy.hpp:62:78:
note: in instantiation of template class
'boost::detail::has_trivial_copy_impl<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<3,
boost::lambda::function_action<3,
boost::lambda::detail::unspecified> >, boost::tuples::tuple<int
(*const)(int, int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<FIRST> >,
const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::unary_arithmetic_action<boost::lambda::minus_action>,
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<SECOND>
>, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> > > >' requested here
BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy_constructor,T,::boost::detail::has_trivial_copy_impl<T>::value)
^
/Users/dolfim/src/boost_1_57_0/boost/type_traits/detail/bool_trait_def.hpp:61:30:
note: expanded from macro
'BOOST_TT_AUX_BOOL_TRAIT_DEF1'
BOOST_TT_AUX_BOOL_C_BASE(C) \
^
/Users/dolfim/src/boost_1_57_0/boost/type_traits/detail/bool_trait_def.hpp:55:81:
note: expanded from macro
'BOOST_TT_AUX_BOOL_C_BASE'
# define BOOST_TT_AUX_BOOL_C_BASE(C) : public
::boost::integral_constant<bool,C>
^
/Users/dolfim/src/boost_1_57_0/boost/function/function_template.hpp:939:20:
note: in instantiation of template class
'boost::has_trivial_copy_constructor<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<3,
boost::lambda::function_action<3,
boost::lambda::detail::unspecified> >, boost::tuples::tuple<int
(*const)(int, int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<FIRST> >,
const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::unary_arithmetic_action<boost::lambda::minus_action>,
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<SECOND>
>, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> > > >' requested here
if (boost::has_trivial_copy_constructor<Functor>::value &&
^
/Users/dolfim/src/boost_1_57_0/boost/function/function_template.hpp:722:13:
note: in instantiation of function template
specialization 'boost::function2<int, int,
int>::assign_to<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<3,
boost::lambda::function_action<3,
boost::lambda::detail::unspecified> >, boost::tuples::tuple<int
(*const)(int, int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<FIRST> >,
const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::unary_arithmetic_action<boost::lambda::minus_action>,
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<SECOND>
>, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> > > >' requested here
this->assign_to(f);
^
/Users/dolfim/src/boost_1_57_0/boost/function/function_template.hpp:1071:5:
note: in instantiation of function template
specialization 'boost::function2<int, int,
int>::function2<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<3,
boost::lambda::function_action<3,
boost::lambda::detail::unspecified> >, boost::tuples::tuple<int
(*const)(int, int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<FIRST> >,
const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::unary_arithmetic_action<boost::lambda::minus_action>,
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<SECOND>
>, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> > > >' requested here
base_type(f)
^
boost_lambda.cpp:14:44: note: in instantiation of function template
specialization 'boost::function<int (int,
int)>::function<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<3,
boost::lambda::function_action<3,
boost::lambda::detail::unspecified> >, boost::tuples::tuple<int
(*const)(int, int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<FIRST> >,
const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::unary_arithmetic_action<boost::lambda::minus_action>,
boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<SECOND>
>, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> > > >' requested here
boost::function<int (int, int)> fuse = boost::lambda::bind(&add,
boost::lambda::_1, -boost::lambda::_2);
^
1 error generated.
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10785> 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:17 UTC