home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / g / bug / 2070 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.4 KB  |  92 lines

  1. Newsgroups: gnu.g++.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!lamisun.epfl.ch!arnaud
  3. From: arnaud@lamisun.epfl.ch ((Pierre Arnaud))
  4. Subject: g++ 2.3.2, exceptions, constructors and delete
  5. Message-ID: <9212221135.AA06826@lamisun3.epfl.ch>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 22 Dec 1992 13:35:47 GMT
  10. Approved: bug-g++@prep.ai.mit.edu
  11. Lines: 79
  12.  
  13. Hi !
  14.  
  15. I have just ported g++ 2.3.2 on my Smaky (a Swiss computer
  16. using a 68020 and running a Swiss real time kernel). I enjoyed
  17. the many improvement you added and very much appreciated that
  18. some known bug have been fixed. But... I stumbled across some
  19. new problems. I don't know if these are well known or if they
  20. aren't bugs at all, but I have posted three problems below.
  21.  
  22.  
  23. I tried to compile this small example :
  24.  
  25. ---cut
  26. class X {
  27.   // ...
  28. public:
  29.   void operator delete (void*, long);
  30. };
  31. ---cut
  32.  
  33. and I got an error saying that "operator delete cannot
  34. be overloaded". Strange indeed, because Stroustrup says it
  35. is possible (C++ prog lang, 2nd ed, section r.12.4, p.577)
  36. or haven't I got it the right way ?
  37.  
  38.  
  39. Well, I heard that the exceptions didn't work fine, but is
  40. this to say that they don't work at all ? I tried following :
  41.  
  42. --cut
  43.   try { } catch (...) { throw; }
  44. --cut
  45.  
  46. and compiled it with the -fansi-exceptions flag, but all I
  47. got was a strange error saying that "cannot convert a pointer
  48. of type `ExceptionHandler' to a pointer of type `'". It is
  49. rather explicit, isn't it ? (-:
  50.  
  51.  
  52. Another problem, when calling a function with a class as a
  53. parameter, I get some trouble :
  54.  
  55. ---cut
  56. class X {
  57.  
  58. public:
  59.   X () { printf ("construct\n"); }
  60.   ~X () { printf ("destroy\n"); }
  61. };
  62.  
  63. void foo (X x) { printf ("foo\n"); }
  64.  
  65. int main ()
  66. {
  67.   foo (X ());
  68.   return 0;
  69. }
  70. ---cut
  71.  
  72. I expected to get the messages "construct", "foo" and "destroy",
  73. but I get "destroy" twice. In fact, the destructor gets called
  74. within `foo' and within `main'. Why ?
  75.  
  76. Could you please have a look at these small examples and give
  77. me some feed-back ? I would be pleased if you could fix these
  78. small problems. I am highly interested in the exception
  79. mechanisms of g++ !
  80.  
  81.  
  82. I wich you Marry Chrismas and a happy new year !!!
  83.  
  84.   Pierre ARNAUD
  85.  
  86.  
  87. Pierre ARNAUD :: EPSITEC-system SA :: CH-1437 Suscevaz, SWITZERLAND
  88.   arnaud@lamisun.epfl.ch :: Swiss Federal Institute of Technology
  89.           "There is always one more bug." (Murphy's law)
  90.  
  91.  
  92.