🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #2154

class X only has private destructor and no friends.

#2154
From: Keith Nishihara
Date: Wed, 10 Jan 1990 20:42
33 lines
1527 bytes
Version: g++ 1.36.2, Dec 8, 1989.
System: Decstation 3100

The following code generates an error message: the text is the message
is both clear, and correct.  However, the code is what I wanted and intended,
and I see no valid reason for dissallowing it.

This is a tokn to be placed on an event queue;  it is created using
operator new, and enqueued.  When either its public Execute method or
public Reset method is called, it either executes or resets the entity
for which it stands, and then delets itself.  Since deletion is only
to be permitted after an execution or reset, the destructor method is
made private.

No error or warning is generated by cfront1.2.

class EventToken
{
public:
    EventToken(EventQueue *q, Instance *inst, Priority p, Time t);

    void                Execute();
    void                Reset();

private:
    ~EventToken();
    ...

};

Error: class `EventToken' only defines a private destructor and has no friends.

Neil/.		Neil%teleos.com@ai.sri.com
Technical Details
Message-ID: <11683@csli.Stanford.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!shelby!csli!keith

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!shelby!csli!keith
From: keith@csli.Stanford.EDU (Keith Nishihara)
Newsgroups: gnu.g++.bug
Subject: class X only has private destructor and no friends.
Message-ID: <11683@csli.Stanford.EDU>
Date: 10 Jan 90 20:42:15 GMT
Sender: keith@csli.Stanford.EDU (Keith Nishihara)
Reply-To: Neil Hunt <Neil%teleos.com@ai.sri.com>
Distribution: gnu
Organization: Center for the Study of Language and Information, Stanford U.
Lines: 33