The C++ Standard, [except.handle], paragraph 4 [ISO/IEC 14882-2014], states the following:
The handlers for a try block are tried in order of appearance. That makes it possible to write handlers that can never be executed, for example by placing a handler for a derived class after a handler for a corresponding base class.
Consequently, if two handlers catch exceptions that are derived from the same base class (such as std::exception
), the most derived exception must come first.
...