Matching between exceptions thrown and caught (C++ only)

An argument in the catch argument of a handler matches an argument in the assignment_expression of the throw expression (throw argument) if any of the following conditions is met:

If the type of the thrown object is const or volatile, the catch argument must also be a const or volatile for a match to occur. However, a const, volatile, or reference type catch argument can match a nonconstant, nonvolatile, or nonreference object type. A nonreference catch argument type matches a reference to an object of the same type.

Related information