[gnu.g++.bug] implicit conversion problem: 1.36

hps@CS.BROWN.EDU (10/27/89)

The following code fragment compiles under CC
----
#include <stream.h>
class D {
 public:
   D() {cout << "D() constructor\n";}
  ~D() {cout << "D destructor\n";}
};

class C {
 public:
   C(D&) {cout << "C(D&) constructor\n";}
   C() {cout << "C() constructor\n";}
  ~C() {cout << "C destructor\n";}
  friend C& operator=(C&,C&);
 };

C& operator=(C& cc, C& bb) {
 cout<<"operator=\n";
 return cc;
}

main() {
 D d;
 C c;
 c = d = c;
}
----
(produces a warning: line 19: warning: bb not used

under g++ it produces an error: 24:conversion between incompatible aggregate types
requested.

this is using version 1.36.0-

uhen substituting the equivalent expression
 operator=(c,operator=(d,c))

Produces the following output:
/usr/local/gnu/1.36/bin/g++ -v p1.cc
gcc version 1.36.0- (based on GCC 1.36)
 /usr/local/gnu/1.36/lib/gcc-cpp -+ -v -I/usr/local/gnu/1.36/lib/g++-include -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ p1.cc /usr/tmp/cca02554.cpp
GNU CPP version 1.36
 /usr/local/gnu/1.36/lib/gcc-cc1plus /usr/tmp/cca02554.cpp -quiet -dumpbase p1.cc -version -o /usr/tmp/cca02554.s
GNU C++ version 1.36.0- (based on GCC 1.36) (sparc) compiled by GNU C version 1.36.
default target switches: -mfpu -mepilogue
p1.cc: In function int main ():
p1.cc:24: Segmentation violation
/usr/local/gnu/1.36/bin/real-g++: Program cc1plus got fatal signal 11.

-Page