🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Glen Ditchfield Mon, 19 Dec 1988 20:58
g++ 1.31 and operator->()
#1553
Author: Glen Ditchfield
Date: Mon, 19 Dec 1988 20:58
44 lines
1916 bytes
"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_
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads