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++/11262] New: qualified non-virtual overload call does not work


Consider this program:

#include <iostream>

class A
{
  public:
  
    int foo()
      { return 1; }

    int foo(int i)
      { return i+1; }

    int foo(int i, int j)
      { return i + j + 1; }

  int m() {
  }

};

class B : public A
{
  public:
  
    int foo()
      { return 83; }

    int foo(int i)
      { return i+83; }

    int foo(int i, int j)
      { return i + j + 83; }

  int m() {
    int i = 1, j = 2;
    std::cout << A::foo() << std::endl;
    std::cout << A::foo(i) << std::endl;
    std::cout << A::foo(i,j) << std::endl;
  }

};

int main()
{
  int i = 1, j = 2;
  B b;

  std::cout << b.foo() << std::endl;
  std::cout << b.foo(i) << std::endl;
  std::cout << b.foo(i,j) << std::endl;

  b.m();
}


If you break in B::m and try "print A::foo()", it will not work:

(gdb) p A::foo()
non-unique member `foo' requires type instantiation

-- 
           Summary: qualified non-virtual overload call does not work
           Product: gdb
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: tromey at redhat dot com
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=11262

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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