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

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