This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Is this a bug?


Is this a bug in the compiler?
I am using version 1.1.2 of the egcs compiler; and when I compile the
following program in DOS or linux, I get this output:

test.cpp: In function `int main()':
test.cpp:33: no matching function for call to `Triangle::render (int, int,
int)'

test.cpp:27: candidates are: Triangle::render()


Shouldn't it call Object::render(float, float, float)?  Instead,
Triangle::render() overrides it!

Could you please E-mail me about this at: christianii@prodigy.net


// test program
class Object
{
public:
  virtual void move(float x, float y, float z);
  virtual void render();                        // render at origin
  void render(float x, float y, float z)        // render at x,y,z
    {move(x,y,z); render(); move(-x,-y,-z);}
};

class Triangle
{
  float v[3][3];
public:
  virtual void move(float x, float y, float z);
  virtual void render();
};

main()
{
  Triangle t;
  t.render(0, 0, -5);
}


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