This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
ADL Help
- From: Perry Smith <pedz at easesoftware dot com>
- To: gcc-help GCC <gcc-help at gcc dot gnu dot org>
- Date: Mon, 6 Nov 2006 08:28:02 -0600
- Subject: ADL Help
Hi,
This is not GCC or G++ specific. I tried posting this to some forums
but did not get any help. I hope you will tolerate the question:
This program compiles and runs. The "here 2" version of f is found:
#include <iostream>
struct NS {
struct T {
static void f(T)
{
std::cout << "here 1" << std::endl;
}
};
static void f(T)
{
std::cout << "here 2" << std::endl;
}
};
NS::T parm;
int main() {
NS::f(parm);
return 0;
}
If the NS::f(parm) is changed to just f(parm), then f is not found.
But if the struct NS is changed to namespace NS, then it is found again.
I am looking at this particular web page to try and understand how
ADL works:
http://www.kuzbass.ru:8086/docs/isocpp/basic.html#basic.lookup.koenig
There are several pages just like it. In particular this bullet would
seem to apply but it must not for some reason:
| If T is a class type, its associated classes are the class itself and
| its direct and indirect base classes. Its associated namespaces are
| the namespaces in which its associated classes are defined.
It seems like the "here 1" version would be found but it is not. Can
you help me to understand what I'm missing?
Thank you very much,
Perry Smith
Ease Software, Inc.
pedz@easesoftware.com
http://www.easesoftware.com
SATA Products for IBMs RS/6000, pSeries, and AIX systems