This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15383] New: name lookup and dependent bases


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]