public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12630] New: gdb is picky on method constness in overload resolution
@ 2011-04-01 16:21 pedro at codesourcery dot com
2011-04-01 17:52 ` [Bug c++/12630] " pedro at codesourcery dot com
2013-10-31 19:31 ` tromey at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: pedro at codesourcery dot com @ 2011-04-01 16:21 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-31 19:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-01 16:21 [Bug c++/12630] New: gdb is picky on method constness in overload resolution pedro at codesourcery dot com
2011-04-01 17:52 ` [Bug c++/12630] " pedro at codesourcery dot com
2013-10-31 19:31 ` tromey at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).