This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/14248] New: Unable to call a templated member function inC++
- From: "thor at math dot tu-berlin.de" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Fri, 15 Jun 2012 09:27:29 +0000
- Subject: [Bug c++/14248] New: Unable to call a templated member function inC++
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=14248
Bug #: 14248
Summary: Unable to call a templated member function in C++
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@sourceware.org
ReportedBy: thor@math.tu-berlin.de
Classification: Unclassified
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x86_64-linux-gnu
If a class contains templated member functions, these member functions are
found by gdb and are printed, but cannot be called.
Consider the following class:
class OpenCLBuffer {
//
// more stuff here...
//
public:
template<typename type> type Peek(unsigned int offset);
};
plus a proper implementation. For the sake of the argument, assume:
template<typename type>
type OpenCLBuffer::Peek(unsigned int offset)
{
return 0;
}
template unsigned char OpenCLBuffer::Peek<unsigned char>(unsigned int);
Using the TAB expansion of gdb shows that this method is actually known to gdb:
p OpenCLBuffer::Peek<un[TAB]
shows (amonst others):
unsigned char OpenCLBuffer::Peek<unsigned char>(unsigned int)
You can even show its address:
(gdb) p OpenCLBuffer::Peek<unsigned char>
$2 = {unsigned char (OpenCLBuffer * const, unsigned int)} 0x76e5be
<OpenCLBuffer::Peek<unsigned char>(unsigned int)>
However, trying to call it from gdb gives nothing:
(gdb) call m_pBuffer[0]->Peek<unsigned char>(0)
Couldn't find method OpenCLBuffer::Peek<unsigned char>
Bummer!
This is version 7.4.1 of gdb. Potentially, this is a duplicate of bug 9423, a
regression from a very old version of gdb.
--
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.