Versions Compared

Key

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

...

Throwing an exception copy-initializes a temporary object, called the exception object. The temporary is an lvalue and is used to initialize the variable declared in the matching handler.

If the copy constructor for the exception object type throws during the copy initialization, std::terminate() is called, which can result in possibly unexpected implementation-defined behavior. For more information on implicitly calling std::terminate(), see ERR50-CPP. Do not abruptly terminate the program.

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

ERR60-CPP

Low

Probable

Medium

P4

L3

Automated Detection

Tool

Version

Checker

Description

Clang
Include Page
Clang_38_V
Clang_38_V
cert-err60-cppChecked by clang-tidy
Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C++3508
Parasoft C/C++test

Include Page
Parasoft_V
Parasoft_V

CERT_CPP-ERR60-a
CERT_CPP-ERR60-b

Exception objects must be nothrow copy constructible
An explicitly declared copy constructor for a class that inherits from 'std::exception' should have a non-throwing exception specification

PRQA QA-C++
Polyspace Bug Finder

Include Page

Polyspace Bug Finder_V
Polyspace Bug Finder

PRQA QA-C++

_V

PRQA QA-

CERT C++

_V3508

: ERR60-CPP

Checks for throwing exception object in copy constructor (rule fully covered)

Related Vulnerabilities

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

...