Bug in egcs (C++)

Mathias Born mborn@faphida.in-berlin.de
Fri Oct 9 15:11:00 GMT 1998


Hello!

I think I have found a bug in the C++ part of egcs.
First some information about my system:
- Linux Red Hat 5.0
- Pentium200
- egcs version: egcs-2.91.57 19980901 (egcs-1.1 release)
- compiled and configured the standard way (->usr/local/egcs)

It can be, that it is not a bug but a feature :-)
I do not know the underlaying c++ standard in evrey detail!

Here the bug:
All you need to reproduce the bug is the following input.
Simply enter "g++ -c <filename> .

== start ==

//********* class A ****************
class A
{
public:
  virtual void alpha(int x);
  void alpha();
};

void A::alpha(int x)
{
  printf("%i\n", x);
}

void A::alpha()
{
  printf("non virtual alpha\n");
}

//********* class B ****************
class B: public A
{
public:
  virtual void alpha(int x);
};

void B::alpha(int x)
{
  // msg here: "no matching function call for call B::alpha ()"
  //           "candidates are: B::alpha(int)"
  alpha();              // egcs does not find A::alpha()
  printf("%i\n", x);
};

/* This works really:

void B::alpha(int x)
{
  A::alpha();
  printf("%i\n", x);
};

*/

== end ==

As shown in the comments, egcs can't find the non-virtual member
function
A::alpha(). Workaround: using of full qualified identifier.

Is this a bug or correct behaviour??


Greetings,
  Mathias Born, Berlin, Germany




More information about the Gcc-bugs mailing list