GDB crashes when I'm trying to print a function.

Here is the code snippet. When I'm trying to print "d.foo()"  in main
function from GDB, it crashes. I'm using GNU gdb 4.18. Is there anyway
to prevent this crash (without making changes to the code)?

#include <iostream>
using namespace std;

class Base1
{
  public:
  void bar()
  {
    cout << "I'm in Base1::bar " << endl;
  }
};

class Base2
{
  public:
  void foo()
  {
    baz();
  }
  virtual void baz() = 0;
};

class Derived:
  public Base1, public Base2
{
public:
  virtual void baz()
  {
    cout << "I'm in Derived::baz " << endl;
  }
}
;


int main()
{
  Derived d;
  d.foo(); // Put breakpoint here
  return 0;
}

_______________________________________________
Help-gplusplus mailing list
Help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to