Full name of submitter (unless configured in github; will be published with the issue): Joshua Berne
Reference (section label): [except.ctor] p2
Link to reflector thread (if any):
Issue description: There is special dispensation in this paragraph to destroy the return object that was created already when an exception escapes the destruction of temporaries or local variables after the return statement has been evaluated. We need the same dispensation for an exception escaping the evaluation of postconditions (because the return object doesn't fall under the general rules for automatic variables because it's not automatic.
The existing paragraph also doesn't seem like it should be about "an exception thrown during the destruction..." but rather an exception escaping that destruction. (An exception thrown and then caught during that destruction should not result in destroying the return object, because that would be insane).
Suggested resolution:
Each object with automatic storage duration is destroyed if it has been constructed, but not yet destroyed,
since the try block was entered. If an exception is thrown during from the destruction of temporaries or local
variables for a return statement (8.8.4), or from the evaluation of postcondition assertions of the enclosing function ([expr.call]), the destructor for the returned object (if any) is also invoked. The
objects are destroyed in the reverse order of the completion of their construction.
Full name of submitter (unless configured in github; will be published with the issue): Joshua Berne
Reference (section label): [except.ctor] p2
Link to reflector thread (if any):
Issue description: There is special dispensation in this paragraph to destroy the return object that was created already when an exception escapes the destruction of temporaries or local variables after the return statement has been evaluated. We need the same dispensation for an exception escaping the evaluation of postconditions (because the return object doesn't fall under the general rules for automatic variables because it's not automatic.
The existing paragraph also doesn't seem like it should be about "an exception thrown during the destruction..." but rather an exception escaping that destruction. (An exception thrown and then caught during that destruction should not result in destroying the return object, because that would be insane).
Suggested resolution:
Each object with automatic storage duration is destroyed if it has been constructed, but not yet destroyed,
since the try block was entered. If an exception is thrown
duringfrom the destruction of temporaries or localvariables for a return statement (8.8.4), or from the evaluation of postcondition assertions of the enclosing function ([expr.call]), the destructor for the returned object (if any) is also invoked. The
objects are destroyed in the reverse order of the completion of their construction.