Article View: gnu.g++.bug
Article #1313Declaration of 'this' pointer...
From: Jack Gould
Date: Mon, 04 Jan 1993 08:38
Date: Mon, 04 Jan 1993 08:38
47 lines
1995 bytes
1995 bytes
Hello.
I am using g++ (v2 preliminary, 27DEC1991) on an SGI machine. When I
Compile the following section:
1 SolvedMatrix& InvertedMatrix::operator*(const BaseMatrix& bmx) const
2 {
3 REPORT
4 SolvedMatrix* x;
5 Try { x = new SolvedMatrix(bm, &bmx); MatrixErrorNoSpace(x); }
6 CatchAll { delete this; Throw(); }
7 delete this; // since we are using bm rather than this
8 return *x;
9 }
I received an error on lines 6 and 7 of the form:
'const *' cannot be deleted.
This exact section compiled without problem on the Borland C++ 3.1 compiler.
The author of the code segment originally compiled this code on g++ (but I
don't know which release).
From Stroustrup (2nd. ed.) I learned that 'this' for a class X is
declared as:
X *const this;
This declaration should allow the delete operator to be applied because 'this'
is not pointing at a constant.
Is this something which has been corrected in a later release of g++?
Or, is this something which is being addressed for a future release? Or, am
I off the mark?
Thank you for your attention to this matter.
Sincerely,
Jack Gould
------------------------------------------------------------------------------
Jack Gould | 'To be or not to be?' - Shakespeare
NASA Lewis Research Center | 'To do is to be.' - Sartre
jjgould@renegade.lerc.nasa.gov | 'Do be do be do!' - Sinatra
------------------------------------------------------------------------------
Technical Details
Message-ID:
<9301041838.AA06530@renegade.lerc.nasa.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!lerc.nasa.GOV!jjgouldShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!lerc.nasa.GOV!jjgould From: jjgould@lerc.nasa.GOV (Jack Gould) Subject: Declaration of 'this' pointer... Message-ID: <9301041838.AA06530@renegade.lerc.nasa.gov> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Mon, 4 Jan 1993 08:38:40 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 50