Hi there,
I have a problem compiling the following code
with g++ 2.95.3 and boost 1.28.0.
---%<---
#include
#include
struct A
{
A(boost::function0<void> const &) { }
};
void foo(boost::function0<void> const &) {}
void bar(unsigned int) {}
int main(int argc, char *argv[])
{
boost::bind(foo, boost::bind(bar, 0)); // ok
A a1(boost::bind(bar, 0)); // ok
A a2(boost::bind(foo, boost::bind(bar, 0))); // error
return 0;
}
--->%---
The line marked with error gives me a whole flood of
error messages. Is this a problem with my version of
gcc? Or am I doing a stupid mistake?
TIA, Markus
PS: Here are the errors I get:
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp: In method `boost::function0::function0<void>(void)':
/opt/ginit/lib/boost-1.28.0/boost/bind.hpp:163: instantiated from `boost::_bi::list1 > >::operator () &), boost::_bi::list0>(boost::_bi::type<void>, void (*)(const boost::function0 &), boost::_bi::list0 &) const'
/opt/ginit/lib/boost-1.28.0/boost/bind/bind_template.hpp:21: instantiated from `boost::_bi::bind_t &),boost::_bi::list1 > > >::operator ()()'
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:127: instantiated from `boost::detail::function::void_function_obj_invoker0 &),boost::_bi::list1 > > >,void>::invoke(boost::detail::function::any_pointer)'
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:437: instantiated from `boost::function0::assign_to &),boost::_bi::list1 > > > >(boost::_bi::bind_t &),boost::_bi::list1 > > >, boost::detail::function::function_obj_tag)'
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:388: instantiated from `boost::function0::assign_to &),boost::_bi::list1 > > > >(boost::_bi::bind_t &),boost::_bi::list1 > > >)'
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:274: instantiated from `boost::function0::function0 &),boost::_bi::list1 > > > >(boost::_bi::bind_t &),boost::_bi::list1 > > >)'
test_bind.cpp:16: instantiated from here
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:271: parameter `f' declared void
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:274: `f' undeclared (first use this function)
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:274: (Each undeclared identifier is reported only once
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:274: for each function it appears in.)
/opt/ginit/lib/boost-1.28.0/boost/bind.hpp: In method `void boost::_bi::list1 > >::operator () &), boost::_bi::list0>(boost::_bi::type<void>, void (*)(const boost::function0 &), boost::_bi::list0 &) const':
/opt/ginit/lib/boost-1.28.0/boost/bind/bind_template.hpp:21: instantiated from `boost::_bi::bind_t &),boost::_bi::list1 > > >::operator ()()'
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:127: instantiated from `boost::detail::function::void_function_obj_invoker0 &),boost::_bi::list1 > > >,void>::invoke(boost::detail::function::any_pointer)'
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:437: instantiated from `boost::function0::assign_to &),boost::_bi::list1 > > > >(boost::_bi::bind_t &),boost::_bi::list1 > > >, boost::detail::function::function_obj_tag)'
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:388: instantiated from `boost::function0::assign_to &),boost::_bi::list1 > > > >(boost::_bi::bind_t &),boost::_bi::list1 > > >)'
/opt/ginit/lib/boost-1.28.0/boost/function/function_template.hpp:274: instantiated from `boost::function0::function0 &),boost::_bi::list1 > > > >(boost::_bi::bind_t &),boost::_bi::list1 > > >)'
test_bind.cpp:16: instantiated from here
/opt/ginit/lib/boost-1.28.0/boost/bind.hpp:163: Internal compiler error in `emit_move_insn_1', at expr.c:2829
Please submit a full bug report.
See URL:http://www.gnu.org/software/gcc/bugs.html for instructions.