A handler with formal parameter of type H, const H, H& or const H&
is a match for a throw expression of type T (at the throw
The following applies to handlers.
- The handlers for a try-catch block are matched in their order of occurrence.
- A handler for a class cannot be placed ahead of a handler for a class
deriving from it, since the handler for the derived
class would never be entered.
- A handler whose formal parameter is an ellipsis (i.e. ...) matches all throw
expressions. An ellipsis that is declared as the formal parameter of a handler
is treated in a manner similar to an ellipsis that is encountered when
performing parameter matching on
overloaded functions. A handler whose formal parameter is an
ellipsis must be the last handler in the list.
- If no match is found for an exception in the list of handlers specified for a
try block then the stack continues to be unwound until the exception is caught
in a containing block or until the stack is completely unwound. When a thread's
stack is completely unwound (due to an uncaught exception) the function
terminate is called.
- An exception is considered handled upon entering a handler, in which case the
stack has been unwound to that point.