home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13124 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.5 KB

  1. Xref: sparky comp.lang.c++:13124 gnu.g++.help:1171
  2. Path: sparky!uunet!decwrl!bu.edu!ai-lab!prep.ai.mit.edu!gnulists
  3. From: schiebel@cs.wvu.wvnet.edu (Darrell Schiebel)
  4. Newsgroups: comp.lang.c++,gnu.g++.help
  5. Subject: Explicit Calls to Destructors (SunCC=ok, gcc=not)
  6. Keywords: destructors
  7. Message-ID: <gnusenet2234@h.cs.wvu.wvnet.edu>
  8. Date: 31 Aug 92 12:46:44 GMT
  9. Followup-To: comp.lang.c++
  10. Organization: WVU Statistics and Computer Science
  11. Lines: 38
  12. Approved: info-gnu@prep.ai.mit.edu
  13. To: gnu-gcc-announce@uunet.uu.net
  14.  
  15.  
  16.     In the Sun (SC1.0 w/ cfront 2.1 (I think)), an explicit call
  17.     to a class' destructor from within a one of the class' member
  18.     functions works:
  19.  
  20.     void Tess::cleanup(Bool abort) {
  21.       Tess::~Tess();
  22.         }
  23.  
  24.     However, in gcc-2.2.2 this does not work, and gives the error:
  25.  
  26. test.cc: In method `void  Tess::cleanup (enum Bool)':
  27. test.cc:28: destructor specification error
  28.  
  29.     Other nonworking variations:
  30.  
  31.     this->~Tess();            AND
  32.     (*this).~Tess();        WITH THE ERROR MESSAGE:
  33.  
  34. test.cc: In method `void  Tess::cleanup (enum Bool)':
  35. test.cc:30: address of `this' not available
  36.  
  37.     and finally:
  38.  
  39.     ~Tess();            WITH:
  40.  
  41. test.cc: In method `void  Tess::cleanup (enum Bool)':
  42. test.cc:30: invalid functional cast
  43.  
  44.     Is there some way to get around this in gcc? Its exactly what
  45.     I want to do; I don't want to force users of my class to call
  46.     parent ``cleanup'' functions, in children. Explicit calls to
  47.     destructors is permitted, ARM p.278, sec 12.4.
  48.  
  49.                         
  50.                         thanks,
  51.                         Darrell Schiebel
  52.                         (schiebel@a.cs.wvu.wvnet.edu)
  53.