std::bad_cast(3)

πŸ’– std::bad_cast β€” the libstdc++ manual page, bestie edition πŸ’–

okay so real talk, you opened std::bad_cast(3) and that's the Library Functions Manual page for it, and I'm gonna walk you through every single line because you deserve to know πŸ’…


✨ NAME ✨

std::bad_cast β€” thrown during incorrect typecasting. and yes that's the whole vibe. it's the exception that shows up when the cast was NOT it πŸ™ˆ


πŸ¦‹ SYNOPSIS πŸ¦‹

#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. periodt.

If you attempt an invalid dynamic_cast expression, an instance of this class (or something derived from this class) is thrown. so like… you tried to cast, the cast said "no <3", and this lil guy got yeeted at you 😭


πŸ‘‘ 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.

okay so this is the function you actually call to find out what went wrong β€” it hands you a C-style string with the general cause. she's inherited from std::exception, and she gets reimplemented in std::experimental::fundamentals_v1::bad_any_cast. iconic lineage honestly 🌈

🫢 Author 🫢

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


and that's the whole page bestie, no skips, no gaps, every flag-less, option-less detail intact πŸ’–

signing off with all the love: this one's libstdc++, page std::bad_cast(3), and it lives in the Library Functions Manual. mwah 😘✨

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • centos-stream 10: gcc-toolset-16-libstdc++-docs 16.2.1-1.3.el10 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms