A quote from the C++ Primer, 4th edition:
The rules for when an exception matches a catch exception specifier are much more restrictive than the rules used for matching arguments with parameter types. Most conversions are not allowedthe types of the exception and the catch specifier must match exactly with only a few possible differences:
1.Conversions from nonconst to const are allowed. That is, a throw of a nonconst object can match a catch specified to take a const reference.
Could you give me an example to explain the first term? Thanks a lot!
Here’s an example
You throw a non-const
int, but you catch it with aconst int&.