This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
namespace and argument dependent name lookup (ADL) in gdb
- From: "Peng Yu" <pengyu dot ut at gmail dot com>
- To: gdb at sourceware dot org
- Date: Wed, 12 Dec 2007 21:38:53 -0600
- Subject: namespace and argument dependent name lookup (ADL) in gdb
Hi,
I don't have to write test::f in the following program because of
argument dependent name lookup.
http://en.wikipedia.org/wiki/Argument_dependent_name_lookup
But to debug such program, I have to write the namespace test. For example,
(gdb) tb f
Function "f" not defined.
(gdb) tb test::f
Breakpoint 1 at 0x804867c: file main.cc, line 11.
I'm wondering if gdb supports ADL. In a big program, it might not be
easy for me to find out which namespace is the function "f" in. If gdb
support ADL, it would save user a lot of time.
Thanks,
Peng
#include <iostream>
namespace test {
struct A {
A() : x(10) { }
int x;
};
void f(const A &a) {
std::cout << a.x << std::endl;
}
}
int main(){
test::A a;
f(a);//do not have to write test::f
}