Boost logo

Boost Users :

From: David Greene (greened_at_[hidden])
Date: 2006-01-09 18:14:04


I'm trying to compile this little program:

#include <boost/bind.hpp>

#include <iostream>

namespace tester {
   class Test {
      public:
         void do_test(void) { std::cout << "Done!" << std::endl; };
   };
};

int main(void)
{
   tester::Test x;

   bind(&tester::Test::do_test, &x, _1)();

   return(0);
}

But I end up with this error (full error trace below):

/tools/i686-pc-linux-gnu/include/boost-1_33_1/boost/bind.hpp:63: error: `
   void (tester::Test::*)()' is not a class, struct, or union type

It looks like somewhere along the way the wrong template specialization
is chosen for result type deduction.

Am I doing something wrong or is this a known problem?

I tried lambda's bind but that also gives an error. It's a different
error but I believe it amounts to the same problem.

Thanks!

                              -Dave

------------------------
bind.cc:16: instantiated from here
/tools/i686-pc-linux-gnu/include/boost-1_33_1/boost/bind.hpp:63: error: `
   void (tester::Test::*)()' is not a class, struct, or union type
/tools/i686-pc-linux-gnu/include/boost-1_33_1/boost/bind/bind_template.hpp:
In instantiation of `boost::_bi::bind_t<boost::_bi::unspecified, void
(tester::Test::*)(), boost::_bi::list2<boost::_bi::value<tester::Test*>,
boost::arg<1> > >':
/tools/i686-pc-linux-gnu/include/boost-1_33_1/boost/bind.hpp:1409:
instantiated from `boost::_bi::bind_t<boost::_bi::unspecified, F,
typename boost::_bi::list_av_2<A1, A2>::type> boost::bind(F, A1, A2)
[with F = void (tester::Test::*)(), A1 = tester::Test*, A2 = boost::arg<1>]'
bind.cc:16: instantiated from here
/tools/i686-pc-linux-gnu/include/boost-1_33_1/boost/bind/bind_template.hpp:15:
error: no
   type named `type' in `struct
   boost::_bi::result_traits<boost::_bi::unspecified, void
(tester::Test::*)()>
   '
/tools/i686-pc-linux-gnu/include/boost-1_33_1/boost/bind/bind_template.hpp:18:
error: no
   type named `type' in `struct
   boost::_bi::result_traits<boost::_bi::unspecified, void
(tester::Test::*)()>
   '
/tools/i686-pc-linux-gnu/include/boost-1_33_1/boost/bind/bind_template.hpp:24:
error: no
   type named `type' in `struct
   boost::_bi::result_traits<boost::_bi::unspecified, void
(tester::Test::*)()>
   '
/tools/i686-pc-linux-gnu/include/boost-1_33_1/boost/bind/bind_template.hpp:30:
error: no
   type named `type' in `struct
   boost::_bi::result_traits<boost::_bi::unspecified, void
(tester::Test::*)()>
   '
/tools/i686-pc-linux-gnu/include/boost-1_33_1/boost/bind/bind_template.hpp:30:
confused by earlier errors, bailing out
make: *** [bind.o] Error 1

Compilation exited abnormally with code 2 at Mon Jan 9 17:08:20


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net