Topic: Understanding Koenig lookup
Author: "Sergey P. Derevyago" <non-existent@iobox.com>
Date: 29 Jul 2002 22:52:51 GMT Raw View
Gennaro Prota wrote:
> Aaaaarghhhhhh!!!! Did someone see that example???? For those who are not
> aware of DR241 here is the code:
IMHO this DR still needs yet another DR (see below).
>
> namespace A {
> struct B { };
> template<int X> void f(B);
> }
>
> namespace C {
> template<class T> void f(T t);
> }
>
> void g(A::B b) {
> f<3>(b); // ill-formed: not a function call
> A::f<3>(b); // well-formed
> C::f<3>(b); // ill-formed; argument dependent lookup
> // applies only to unqualified names
The comment above has to be corrected because
C::f<A::B>(b); // well-formed
I.e. C::f<3>(b) is ill-formed just because we can't specialize
template<class T> f with constant 3: C::f<> needs a typename.
> using C::f;
> f<3>(b); // well-formed because C::f is visible; then
> // A::f is found by argument dependent lookup
> }
So the example in 14.8.1 is much more confusing than it was stated by DR241.
--
With all respect, Sergey. http://cpp3.virtualave.net/
mailto : ders at skeptik.net
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
[ 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 ]