Topic: Function argument destructor throws
Author: Alexandre Oliva <oliva@dcc.unicamp.br>
Date: 1997/06/07 Raw View
Hi!
I was handling a g++ bug report today and I found the following
(simplified) situation:
struct bar { ~bar() { throw 1; };
class baz {};
baz foo(bar b) { return baz(); }
main() {
foo(bar());
}
The user complained that the baz temporary created as return value of
foo was not being destructed because bar's destructor threw an
exception. I seem to agree it would be quite reasonable to have this
temporary's destructor invoked, but I could not find any such
requirement in the CD2. Can anyone help?
Besides, I could not find any requirement regarding the order of
destruction of function argument temporaries: I assume the standard
rule of destruction in reverse order of construction stands then, am I
right?
Regards,
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
Universidade Estadual de Campinas, SP, Brasil
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]