Bug 7497 - GDB can't resolve calls to member functions oftemplate classes
Summary: GDB can't resolve calls to member functions oftemplate classes
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gdb
Version: 6.1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-12-01 22:37 UTC by mcmillan
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2000-05-30 18:26:23 UTC

Attachments (Terms of Use)

Description mcmillan 1999-12-01 22:37:14 UTC
Note: I've also sent this bug the bug-gdb mailing list.
Reverting to the version of GDB in RH5.2 solves the problem.

GDB can't seem to resolve calls to member functions of
template classes in a "print" command. This used to work,
but now gives the error message:

Cannot resolve method ... to any overloaded instance

GDB version: 4.18
Compiler: egcs 1.1.2 or gcc 2.95.1


#include <stream.h>

template<class foo>
class bar {
  foo i;
  void show() {
    cout << i;

  bar<int> q;
  q.show();    /* included just to instantiate member */

Compile thus:

g++ -g gdbbug.cc -o gdbbug

Debug thus:

gdb gdbbug
b main
p q.show()

Gdb response:

Cannot resolve method bar<int>::show to any overloaded instance

This was run under Red Hat 6.1. At the very least, the error
message makes no sense, since a function with no arguments cannot
be overloaded.

Comment 1 Jim Kingdon 1999-12-07 22:09:59 UTC
I was able to reproduce this problem with gdb-4.18-6 which is what is
in Rawhide.

Comment 2 Tim Ruhl 1999-12-17 08:54:59 UTC
Seems to be fixed in Debian distribution; see Bug#43955 Debian Bugs database.

Comment 3 Cristian Gafton 2000-02-17 22:44:59 UTC
jim, can you please check that bug out?

Comment 4 Jim Kingdon 2000-02-18 01:35:59 UTC
Note that Debian bug #43955 does not contain a fix as far as I could

Comment 5 Jim Kingdon 2000-03-12 14:10:59 UTC
I believe this is fixed by Dan Berlin's checkin of 2000-03-10 to valops.c
(I know Dan Berlin has a fix and I think that is the one).  So try GDB
from CVS (http://sourceware.cygnus.com/gdb/) or wait for us to get
around to putting that GDB into Rawhide (I'd recommend the former but
I may be biased :-)).

Comment 6 Andrew Lincoln Burrow 2000-03-17 13:20:59 UTC
I have been able to cure this problem by setting
"over-load-resolution" off.
The bug may be as little as a mixed up condition test.
For example, under gud on an i386, RedHat 6.1 system:

(gdb) set overload-resolution off
(gdb) p _cons.const_types()
$1 = (KrInheritanceHierarchy *) 0x8127a88
(gdb) set overload-resolution on
(gdb) p _cons.const_types()
Cannot resolve method KrManualCons::const_types to any overloaded instance

Comment 7 Trond Eivind Glomsrxd 2000-05-30 18:26:59 UTC
GDB 5.0 is now in Rawhide, and fixes this problem.

Note You need to log in before you can comment on or make changes to this bug.