Boost logo

Boost :

Subject: Re: [boost] [bind] Error C4430 in bind.hpp
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2012-03-15 11:59:14


On Thu, Mar 15, 2012 at 9:25 AM, Lars Viklund <zao_at_[hidden]> wrote:

> Please don't top-post. Respond in-line or at the bottom.
>
> On Thu, Mar 15, 2012 at 08:25:54AM -0500, Robert Dailey wrote:
> > >> For some reason when I include <boost/bind.hpp> I get the following
> > >> errors:
> > >>
> > >>
> 1>c:\code\work\cmake-mds\build-vc9\third_party\boost\1.48.0\include\boost\bind\bind.hpp(1200)
> > >> : error C4430: missing type specifier - int assumed. Note: C++ does
> not
> > >> support default-int
> > >>
> 1>c:\code\work\cmake-mds\build-vc9\third_party\boost\1.48.0\include\boost\bind\bind.hpp(1201)
> > >> : error C4430: missing type specifier - int assumed. Note: C++ does
> not
> > >> support default-int
>
> [snip]
>
> > >>
> > >> They point to this code in bind.hpp:
> > >>
> > >> BOOST_BIND_OPERATOR( ==, equal )
> > >> BOOST_BIND_OPERATOR( !=, not_equal )
>
> [snip]
>
> > >> Any idea why this is failing? If more info is needed please let me
> know.
>
> Try preprocessing your source and see what these macros expand to on
> your configuration, preferably doing the same on a known good machine.

Thanks for the help. I generated a preprocessed file for this translation
unit (the one including bind.hpp) and I see the following generated code:

struct equal { template<class V, class > bool operator()(V const & v,
 const & w) const { return v == w; } }; template<class R, class F, class L,
class A2> bind_t< bool, equal, list2< bind_t<R, F, L>, typename
add_value<A2>::type > > operator == (bind_t<R, F, L> const & f, A2 a2) {
typedef typename add_value<A2>::type B2; typedef list2< bind_t<R, F, L>,
B2> list_type; return bind_t<bool, equal, list_type> ( equal(),
list_type(f, a2) ); }
struct not_equal { template<class V, class > bool operator()(V const & v,
 const & w) const { return v != w; } }; template<class R, class F, class L,
class A2> bind_t< bool, not_equal, list2< bind_t<R, F, L>, typename
add_value<A2>::type > > operator != (bind_t<R, F, L> const & f, A2 a2) {
typedef typename add_value<A2>::type B2; typedef list2< bind_t<R, F, L>,
B2> list_type; return bind_t<bool, not_equal, list_type> ( not_equal(),
list_type(f, a2) ); }

struct less { template<class V, class > bool operator()(V const & v, const
& w) const { return v < w; } }; template<class R, class F, class L, class
A2> bind_t< bool, less, list2< bind_t<R, F, L>, typename
add_value<A2>::type > > operator < (bind_t<R, F, L> const & f, A2 a2) {
typedef typename add_value<A2>::type B2; typedef list2< bind_t<R, F, L>,
B2> list_type; return bind_t<bool, less, list_type> ( less(), list_type(f,
a2) ); }
struct less_equal { template<class V, class > bool operator()(V const & v,
 const & w) const { return v <= w; } }; template<class R, class F, class L,
class A2> bind_t< bool, less_equal, list2< bind_t<R, F, L>, typename
add_value<A2>::type > > operator <= (bind_t<R, F, L> const & f, A2 a2) {
typedef typename add_value<A2>::type B2; typedef list2< bind_t<R, F, L>,
B2> list_type; return bind_t<bool, less_equal, list_type> ( less_equal(),
list_type(f, a2) ); }

struct greater { template<class V, class > bool operator()(V const & v,
 const & w) const { return v > w; } }; template<class R, class F, class L,
class A2> bind_t< bool, greater, list2< bind_t<R, F, L>, typename
add_value<A2>::type > > operator > (bind_t<R, F, L> const & f, A2 a2) {
typedef typename add_value<A2>::type B2; typedef list2< bind_t<R, F, L>,
B2> list_type; return bind_t<bool, greater, list_type> ( greater(),
list_type(f, a2) ); }
struct greater_equal { template<class V, class > bool operator()(V const &
v, const & w) const { return v >= w; } }; template<class R, class F, class
L, class A2> bind_t< bool, greater_equal, list2< bind_t<R, F, L>, typename
add_value<A2>::type > > operator >= (bind_t<R, F, L> const & f, A2 a2) {
typedef typename add_value<A2>::type B2; typedef list2< bind_t<R, F, L>,
B2> list_type; return bind_t<bool, greater_equal, list_type> (
greater_equal(), list_type(f, a2) ); }

struct logical_and { template<class V, class > bool operator()(V const & v,
 const & w) const { return v && w; } }; template<class R, class F, class L,
class A2> bind_t< bool, logical_and, list2< bind_t<R, F, L>, typename
add_value<A2>::type > > operator && (bind_t<R, F, L> const & f, A2 a2) {
typedef typename add_value<A2>::type B2; typedef list2< bind_t<R, F, L>,
B2> list_type; return bind_t<bool, logical_and, list_type> ( logical_and(),
list_type(f, a2) ); }
struct logical_or { template<class V, class > bool operator()(V const & v,
 const & w) const { return v || w; } }; template<class R, class F, class L,
class A2> bind_t< bool, logical_or, list2< bind_t<R, F, L>, typename
add_value<A2>::type > > operator || (bind_t<R, F, L> const & f, A2 a2) {
typedef typename add_value<A2>::type B2; typedef list2< bind_t<R, F, L>,
B2> list_type; return bind_t<bool, logical_or, list_type> ( logical_or(),
list_type(f, a2) ); }

It's a nightmare to look at so I hope you can find the problem. I never was
very good at debugging boost issues. I'm pretty sure it's one of the header
files being included before it, but I have no idea what the conflict is.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk