schmidt%siam.ics.uci.edu@PARIS.ICS.UCI.EDU ("Douglas C. Schmidt") (01/26/89)
Hi,
   I believe the following is a rather subtle and pernicious bug with
g++ 1.32.  According to the USENIX Lime book, pages 10-11, assignment
in C++ is now defined as memberwise assignment of non-static members
and base class objects, rather than bitwise copy.  Therefore, the
following program appears to be in error:
----------------------------------------
#include <stream.h>
#include <String.h>
class Foobar // note that no explicit assigment is defined
{
public:
  String foo;
  Foobar (String a)
    {
      foo = a;
    }
  Foobar (void)
    {
    }
#ifdef FIXBUG
  operator = (Foobar &f)
    {
      foo = f.foo;
    }
#endif
};
main ()
{
  Foobar foo ("foo::hello");
  Foobar bar;
  bar = foo; // this is making an improper bit-wise copy here
  cout << bar.foo << "\n";
  cout << "(bar.foo == foo.foo) == " << (bar.foo == foo.foo) << "\n";
  foo.foo = "new::hello";
  cout << bar.foo << "\n"; // yow, there's an improper alias here!
}
----------------------------------------
Doug