MISRA C++:2008 Rule 15-5-1
A class destructor shall not exit with an exception
Description
Rule Definition
A class destructor shall not exit with an exception.
Polyspace Implementation
The checker flags exceptions thrown in the body of the destructor. If the destructor calls another function, the checker does not detect if that function throws an exception.
The checker does not detect these situations:
A
catch
statement does not catch exceptions of all types that are thrown.The checker considers the presence of a
catch
statement corresponding to atry
block as indication that an exception is caught.throw
statements insidecatch
blocks
Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Exception Handling |
Category: Required |
Version History
Introduced in R2013b