Topic: koenig lookup question - compilers disagree


Author: loewis@informatik.hu-berlin.de (Martin v. =?iso-8859-1?q?L=F6wis?=)
Date: Fri, 27 Sep 2002 16:36:16 +0000 (UTC)
Raw View
rani_sharoni@hotmail.com ("Rani Sharoni") writes:

> I think that according to 3.4.2/2 sub-bullet 8 the answer is yes which also
> makes namespace N an associate namespace of B and the above code legal
> (3.4.2/2 sub 2).
[...]
> I find it hard to believe that EDG is wrong in such cases and I
> guess that I 'm probably missing something.

I agree with your analysis. But then, I implemented Koenig lookup in
gcc, so I'm biased.

Regards,

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: rani_sharoni@hotmail.com ("Rani Sharoni")
Date: Thu, 26 Sep 2002 17:47:25 +0000 (UTC)
Raw View
Hello all:

Consider the following code:

template<typename T> struct A {};

namespace N {
    struct X {};
    void f(A<X> &);
}

struct B : A<N::X> {};

int main() {
    A<N::X> a;
    f(a); // fine - 3.4.2/2 sub-bullet 8

    B b;
    f(b); // (*) finds N::f ?
}

EDG 3.0.0 rejected (*) but gcc 3.2 and VC7.1 beta accepted (*) finding N::f.

Is the above f(b) bound to N::f?
Is namespace N is an associate namespace of A<N::X>?
I think that according to 3.4.2/2 sub-bullet 8 the answer is yes which also
makes namespace N an associate namespace of B and the above code legal
(3.4.2/2 sub 2).

I find it hard to believe that EDG is wrong in such cases and I guess that I
'm probably missing something.



Thanks,

Rani







---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]