This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/15383] New: name lookup and dependent bases
- From: "tromey at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Fri, 19 Apr 2013 18:06:11 +0000
- Subject: [Bug c++/15383] New: name lookup and dependent bases
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=15383
Bug #: 15383
Summary: name lookup and dependent bases
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@sourceware.org
ReportedBy: tromey@redhat.com
Classification: Unclassified
Consider this test case:
int f() { return 23; }
template<typename T>
struct Base {
int f() { return 13; }
};
template<typename T>
struct Derived : public Base<T> {
int g() { return f(); }
};
int main()
{
Derived<int> value;
return value.g();
}
Here, Derived::g calls ::f, not Base::f.
This is due to a C++ name lookup rule, see:
http://gcc.gnu.org/onlinedocs/gcc/Name-lookup.html
http://gcc.gnu.org/wiki/VerboseDiagnostics#dependent_base
gdb implements this wrongly -- if you stop in g and try to call f,
gdb will try to call Base::f.
--
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.