gjditchfield@watmsg.waterloo.edu (Glen Ditchfield) (12/20/88)
"operator->" must be a no-argument member function, but G++ 1.31 (and 1.25) seems to think it must have arguments. (Frankly, I was expecting a "Sorry, not implemented" message.) All this on a vax running BSD 4.3, with tm.h and md linked to tm-vax.h and vax.md. The two patches posted on monday the 19th haven't been applied. This code is based on the example in "The Evolution of C++: 1985 to 1987". -------- opptr.cc ------------------------------------------------------------- struct Y { int m;}; class X { Y* p; public: Y* operator->(); X() { p = 0;}; }; Y* X::operator->() { if (p == 0) p = new Y; return p; }; main() { X an_x; an_x->m = 5; }; ------------------------------------------------------------------------------- [6]% g++ -v -c opptr.cc g++ version 1.31.0 /usr/local/lib/gcc-cpp+ -v -undef -D__GNU__ -D__GNUG__ -Dvax -Dunix opptr.cc /tmp/cc008179.cpp GNU CPP version 1.31.0 /usr/local/lib/gcc-c++ /tmp/cc008179.cpp -quiet -dumpbase opptr.cc -noreg -version -o /tmp/cc008179.s GNU C++ version 1.31.0 (vax) compiled by GNU C version 1.31. opptr.cc:5: wrong number of parameters to `operator ->()' opptr.cc:5: `operator ->()' must have at least one class type opptr.cc:8: parse error before `{' In function main (): opptr.cc:14: base operand of `->' is not a pointer Compilation finished at Mon Dec 19 15:19:41 Glen Ditchfield gjditchfield@violet.uwaterloo.ca Office: DC 2517 Dept. of Computer Science, U of Waterloo, Waterloo, Ontario, Canada, N2L 3G1 "... and the rest, we will spend foolishly!" -- _Svengali_