Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-12-21 00:00:04


"Aleksey Gurtovoy" <agurtovoy_at_[hidden]> wrote
> David Abrahams writes:
> > Arkadiy Vertleyb wrote:
> > > Hi all,
> > >
> > > I was porting my older stuff into Boost 1.32, and it went fine with
VC71.
> > > However, using g++ 3.3, I ran into a lot of naming conflicts between
STL and
> > > MPL algoritms, such as find_if, copy_if, etc. From looking into
previous
> > > posts, I can see that tis relates to a combination of problems in the
g++
> > > STL, such as using unqualified calls, and ADL not working correctly.
> > >
> > > Does anybody know if the problem was fixed in later versions of GCC?
> >
> > That's rather disturbing to hear. I know that for 1.32 Aleksey jumped
> > through considerable hoops specifically to avoid unintentional ADL
> > effects that crop up with GCC because of its "interesting
> > interpretation" of the standard. If anything, 1.32 should be much
> > better than previous versions in this regard.
>
> True. I'd like to see specific instances of the conflicting code.

Here is an emulation -- I use my own unqualified call instead of STL (and
AFAIK g++ STL makes lots of unqualified calls):

----------- a.cpp --------------------------------

#include <boost/mpl/find.hpp>
#include <boost/mpl/vector.hpp>

namespace X
{
    template<class T>
        void find(const T&)
    {}
    template<class T> struct row
    {};
    void foo()
    {
        find(row<boost::mpl::vector0<> >());
    }
}

int main()
{
    X::foo();
    return 0;
}
----------------------------------

The result is:

C:\ark\gcctest>g++ -I c:\boost\boost_1_32_0 a.cpp
c:/boost/boost_1_32_0/boost/mpl/find.hpp: In function `void X::foo()':
c:/boost/boost_1_32_0/boost/mpl/find.hpp:29: error: `template<class
Sequence,
   class T> struct boost::mpl::find' is not a function,
a.cpp:8: error: conflict with `template<class T> void X::find(const T&)'
a.cpp:13: error: in call to `find'

As you can see, the parameter to foo() makes the compiler consider the
boost::mpl namespace for ADL. The combination of unqualified call and g++
finding class templates during ADL produces the error.

Regards,

Arkadiy


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