This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/12630] New: gdb is picky on method constness in overloadresolution
- From: "pedro at codesourcery dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Fri, 1 Apr 2011 16:21:21 +0000
- Subject: [Bug c++/12630] New: gdb is picky on method constness in overloadresolution
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=12630
Summary: gdb is picky on method constness in overload
resolution
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@sourceware.org
ReportedBy: pedro@codesourcery.com
With:
struct base
{
int overload (void) const { return 0; } // base::overload(void) const
int overload (int) const { return 0; } // base::overload(int) const
};
int
main (int argc, char* argv[])
{
base a;
(void) a.overload ();
(void) a.overload (1);
return 0;
}
Listing the (void) variant without the `const' fails:
(gdb) list 'base::overload()'
the class `base' does not have any method instance named overload()
With `const', it succeeds:
(gdb) list 'base::overload() const'
1 struct base
2 {
3 int overload (void) const { return 0; } // base::overload(void)
const
4 int overload (int) const { return 0; } // base::overload(int) const
5 };
Since there's no ambiguity, gdb could pick the const variant without the
explicit `const'.
This affects "break" and "print" similarly.
Interestingly, if you drop all but one of the overloads (hence, no overloads)
gdb ignores all the prototype arguments you specify, and always finds
something:
(gdb) list 'base::overload'
1 struct base
...
(gdb) list 'base::overload()'
1 struct base
...
(gdb) list 'base::overload(asdf1234)'
1 struct base
...
(gdb) list 'base::overload(?????)'
1 struct base
...
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.