Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Noncompliant Code Example (function-try-block)

This noncompliant code example, as well as the following compliant solution, presumes the existence of a Bad class with a destructor that can throw. Although the class violates this rule, it is presumed that the class cannot be modified to comply with this rule.

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

DCL57-CPP

Low

Likely

Medium

P6

L2

Automated Detection

Tool

Version

Checker

Description

Astrée

Include Page
Astrée_V
Astrée_V

destructor-without-noexcept
delete-without-noexcept
Fully checked
Axivion Bauhaus Suite

Include Page
c:Axivion Bauhaus Suite_Vc:
Axivion Bauhaus Suite_V

CertC++-DCL57
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

LANG.STRUCT.EXCP.CATCH

LANG.STRUCT.EXCP.THROW

Use of catch

Use of throw

Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C++2045, C++2047, C++4032, C++4631
Klocwork
Include Page
Klocwork_V
Klocwork_V

MISRA.DTOR.THROW


LDRA tool suite
Include Page
LDRA_V
LDRA_V

453 S

Partially implemented

Parasoft C/C++test

Include Page
Parasoft_V
Parasoft_V

CERT_CPP-DCL57-a
CERT_CPP-DCL57-b

Never allow an exception to be thrown from a destructor, deallocation, and swap
Always catch exceptions

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

CERT C++: DCL57-CPPChecks for class destructors exiting with an exception (rule partially covered)
PVS-Studio

Include Page
PVS-Studio_V
PVS-Studio_V

V509, V1045
RuleChecker
Include Page
RuleChecker_V
RuleChecker_V
destructor-without-noexcept
delete-without-noexcept
Fully checked

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

...