This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[cd]tor handler does not rethrow


The following program:

#include <iostream.h>
struct X {
  X()
    try { throw 1; }
  catch (...) { cout << "caught" << endl; }
};
int main()
  try { X x; cout << "ok" << endl; }
catch (...) { cout << "caught again" << endl; }

compiled with several different versions of g++/egcs will print:

caught
ok

... instead of:

caught
caught again

... as required by paragraph 16 of the Nov '97 DWP (in
function-try-blocks of constructors and destructors, falling off a
handler causes the handled exception to be rethrown)

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]