tom@tnosoes.UUCP (Tom Vijlbrief) (11/21/89)
g++ cannot parse the following. Is this a compiler error or a C++ problem ? I want access to the global assignment operator. ===============================opis.c========= class test { public: int i; operator=(int ii) { i= ii; } operator=(test& t) { this->::operator=(t);} // operator=(test& t) { *this ::operator= t;} // Fails also }; main() { test a,b; a= b; } =============================================== tom@sunflare:~/src/CC> !g g++ -v opis.c gcc version 1.36.1- (based on GCC 1.36) /usr/local/lib/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 opis.c /usr/tmp/cca09024.cpp GNU CPP version 1.36 /usr/local/lib/gcc-cc1plus /usr/tmp/cca09024.cpp -quiet -dumpbase opis.c -version -o /usr/tmp/cca09024.s GNU C++ version 1.36.1- (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36. default target switches: -m68020 -mc68020 -m68881 -mbitfield opis.c: In method int test::operator = (class test &): opis.c:6: parse error at end of input tom@sunflare:~/src/CC> =============================================================================== Tom Vijlbrief TNO Institute for Perception P.O. Box 23 Phone: +31 34 63 562 11 3769 ZG Soesterberg E-mail: tnosoes!tom@mcvax.cwi.nl The Netherlands or: uunet!mcvax!tnosoes!tom ===============================================================================
schmidt@glacier.ics.uci.edu (Doug Schmidt) (11/22/89)
In article <504@tnosoes.UUCP>, tom@tnosoes (Tom Vijlbrief) writes: >g++ cannot parse the following. > >Is this a compiler error or a C++ problem ? > >I want access to the global assignment operator. > >===============================opis.c========= >class test { >public: > int i; > > operator=(int ii) { i= ii; } > operator=(test& t) { this->::operator=(t);} > // operator=(test& t) { *this ::operator= t;} // Fails also >}; > >main() >{ > test a,b; > > a= b; >} Sounds like a C++ language feature. Here's what cfront sez: "glob.c", line 6: error: member operator = undefined Doug -- schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente. office: (714) 856-4043 | Per me si va nell'eterno dolore. | Per me si va tra la perduta gente. | Lasciate ogni speranza o voi ch'entrate.
rfg@ics.uci.edu (Ron Guilmette) (11/22/89)
In article <504@tnosoes.UUCP> tom@tnosoes.UUCP (Tom Vijlbrief) writes: >g++ cannot parse the following. > >Is this a compiler error or a C++ problem ? ... >opis.c:6: parse error at end of input I have seen this type of error message (also issued at lines in the *middle* of some source files) before. In my case, this was due to the fact that (a) the setbuf() routine on SystemV behaves badly if you try to set the buffer to a buffer which is only 8 bytes or less in length, and (b) cplus-lex.c has not yet been fixed to account for this System-5 specific problem, and (c) I was running G++ under System V. If you are using System V, look at the calls to setbuf() in cplus-lex.c. I believe that there are special #ifdefs in those two vicinities that are for i386, and that the i386 case should be right for *all* system V machines. I hope that helps. P.S. The setbuf() routine comes into play because G++ saves the bodies of inline routines away in "buffers" which it later goes back and re-reads. // rfg