std::bad_exception (3) - Linux Manuals
std::bad_exception: std::bad_exception
NAME
std::bad_exception - std::bad_exception
Synopsis
Defined in header <exception>
class bad_exception;
std::bad_exception is the type of the exception thrown by the C++ runtime in the following situations:
1) If std::exception_ptr stores a copy of the caught exception and if the copy constructor of the exception object caught by std::current_exception throws an exception, the captured exception is an instance of std::bad_exception.
2) If a dynamic_exception_specification is violated and std::unexpected throws or rethrows an exception that still violates the exception specification, but the exception specification allows std::bad_exception, std::bad_exception is thrown. (until C++17)
std-bad exception-inheritance.svg
Inheritance diagram
Member functions
constructor (public member function)
operator= (public member function)
what returns the explanatory string
[virtual]
Inherited from std::exception
Member functions
destructor destroys the exception object
[virtual]
what returns an explanatory string
[virtual]
Example
// Run this code
Output: