Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-09-17 09:40:15


Joel de Guzman wrote:
> Peter Dimov <pdimov_at_[hidden]> wrote:
>> Joel de Guzman wrote:
>> [...]
>>> g++ (3.2) complains:
>>>
>>> In function `int main()':
>>> template<class C, class T1, class T2> struct boost::mpl::if_' is not
>>> a function, conflict with `template<int N> void
>>> X::if_(boost::mpl::int_<N>)' in call to `if_'
>>>
>>> VC7.1 is OK.
>>>
>>> This is, AFAICT, an ADL (Koenig-lookup) problem. Which is correct,
>>> g++ or VC7.1?
>>
>> Depends on who you ask. My opinion is that VC 7.1 is correct. This
>> is an open core issue.
>
> I agree. How about this:
>
> namespace X
> {
> template <int N, typename T = boost::mpl::int_<N> >
> struct Y {};
>
> template <int N>
> void
> if_(Y<N>)
> {
> };
> }
>
> int
> main()
> {
> using namespace X;
> if_(Y<1>());
> }
>
> ??? definitely a bug ???

boost::mpl is still an associated namespace for Y<1>, so from compiler point
of view this is basically the same example. Human readers will find it even
less tolerable, of course. Also:

#include <list>
#include <memory>

template< class T, class A = std::allocator<T> > struct X {};

template<class T, class A> void list(X<T, A> const & x)
{
}

int main()
{
    X<int> x;
    list(x);
}

All we can do is submit a g++ bug.


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