Boost logo

Boost Users :

From: Antoine Boivin Filion (abf_at_[hidden])
Date: 2002-11-28 11:20:47


Hi,
FYI, the code below compiles and runs OK on MSVC++7... so you might just be
right!
 
Regards,
Antoine
 
-----Original Message-----
From: Andre Hentz [mailto:ahentz_at_[hidden]]
Sent: November 28, 2002 09:42
To: Boost-Users_at_[hidden]
Subject: [Boost-Users] MSVC++, bind and namespaces

I've just encountered this problem and it looks like a MS bug. Not sure it
deserves a Boost workaround but I thought it would be nice to let you know
(in case you don't already).

Here's the code:

#include <boost/bind.hpp>
namespace A{
        struct c{
                void setName(const char*) {}
        };
}
namespace B{
        struct c{
                void setName(const char*) {}
        };
}
using namespace B;
using namespace A;
int main() {
        boost::bind(&A::c::setName, _1, _2);
        return 0;
}

It looks legal to me but I'm no expert. GCC compiles with no warnings but
MSVC++ 6sp5 gives the error below.

boost/bind/mem_fn_vw.hpp(29) : error C2872: 'c' : ambiguous symbol
        boost/bind.hpp(875) : see reference to class template
instantiation 'boost::_mfi::mf1<void
,struct A::c,char const *>' being compiled

        boost/bind.hpp(886) : see reference to class template
instantiation 'boost::_bi::bind_t_generator<void>::implementation<struct
boost::_mfi::mf1<void,struct A::c,char const *>,class
boost::_bi::list2<class boost::arg<1>,class boost::arg<2> > >' being
compiled

        test.cpp(15) : see reference to class template instantiation
'boost::_bi::bind_t<void,struct boost::_mfi::mf1<void,struct A::c,char
const *>,class boost::_bi::list2<class boost::arg<1>,cla
ss boost::arg<2> > >' being compiled

boost/bind/mem_fn_vw.hpp(31) : error C2872: 'c' : ambiguous symbol
        boost/bind.hpp(875) : see reference to class template
instantiation 'boost::_mfi::mf1<void,struct A::c,char const *>' being
compiled

        boost/bind.hpp(886) : see reference to class template
instantiation 'boost::_bi::bind_t_generator<void>::implementation<struct
boost::_mfi::mf1<void,struct A::c,char const *>,class
boost::_bi::list2<class boost::arg<1>,class boost::arg<2> > >' being
compiled

        test.cpp(15) : see reference to class template instantiation
'boost::_bi::bind_t<void,struct boost::_mfi::mf1<void,struct A::c,char
const *>,class boost::_bi::list2<class boost::arg<1>,class boost::arg<2> >
>' being compiled

Best,

                        Andre Hentz

Yahoo! Groups Sponsor

ADVERTISEMENT
 
<http://rd.yahoo.com/M=237459.2675695.4055211.2225243/D=egroupweb/S=17050067
88:HM/A=1267611/R=0/*http://ad.doubleclick.net/jump/N2524.Yahoo/B1071650;sz=
300x250;ord=1038499880908608?>
 
<http://us.adserver.yahoo.com/l?M=237459.2675695.4055211.2225243/D=egroupmai
l/S=:HM/A=1267611/rand=601430356>

Info: < http://www.boost.org <http://www.boost.org> >
Wiki: < http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl
<http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> >
Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .

[Non-text portions of this message have been removed]


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