[gnu.g++.bug] virtual strangeness

pell@ISY.LIU.SE (P{r Emanuelsson) (07/28/89)

What about this?

class base {
  public:
  char *data;
  virtual void operator=(const base& in) {
    printf("NYI!\n");
  }
};

class derived : public base {
  public:
  void operator=(base& in) {
    data = in.data;
  }
};

main()
{
  base *e = new derived;
  base *m = new derived;

  *e = *m;
}

With cfront 1.2 this works as (I) expected. With G++ it prints "NYI!".
Why is this? Neither compiler complains about anything.

Machine: Sun386i
--
"Don't think; let the machine do it for you!"
                                   -- E. C. Berkeley
Dept. of Electrical Engineering	                         pell@isy.liu.se
University of Linkoping, Sweden	                    ...!uunet!isy.liu.se!pell