std::bad_cast(3)

std::bad_cast3

Thrown during incorrect typecasting.

Usage

#include <typeinfo>

Inherits std::exception.

Inherited by std::experimental::fundamentals_v1::bad_any_cast.

Public Member Functions

virtual constexpr const char * what () const noexcept

Detailed Description

Thrown during incorrect typecasting.

If you attempt an invalid dynamic_cast expression, an instance of this class (or something derived from this class) is thrown.

Member Function Documentation

virtual constexpr const char * std::bad_cast::what () const [inline], [constexpr], [virtual], [noexcept]

Returns a C-style character string describing the general cause of the current error.

Reimplemented from std::exception.

Reimplemented in std::experimental::fundamentals_v1::bad_any_cast.

Releases

4 releases since Debian 3.1 (Sarge); the text changed 3 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. Arch

Author

Generated automatically by Doxygen for libstdc++ from the source code.

From gcc 16.2.1+r23+gd564253eb6c8-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.