Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Peng Yu" <pengyu.ut@gmail.com>
To: gdb@sourceware.org
Subject: namespace and argument dependent name lookup (ADL) in gdb
Date: Thu, 13 Dec 2007 03:39:00 -0000	[thread overview]
Message-ID: <366c6f340712121938j2fc71e6dmf69a9395ca6d8f6f@mail.gmail.com> (raw)

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
}


             reply	other threads:[~2007-12-13  3:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-13  3:39 Peng Yu [this message]
2007-12-13  4:02 ` Daniel Jacobowitz
     [not found]   ` <366c6f340712141515u4a55053if6bc378bc6712975@mail.gmail.com>
2007-12-15  4:46     ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=366c6f340712121938j2fc71e6dmf69a9395ca6d8f6f@mail.gmail.com \
    --to=pengyu.ut@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox