---
name: "__gnu_cxx::forced_error"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_cxx::forced_error/3cxx"
---

# \_\_gnu\_cxx::forced\_error(3cxx)

Thrown by utilities for testing exception safety.

## NAME

\_\_gnu\_cxx::forced\_error - Thrown by utilities for testing exception safety.

## SYNOPSIS

`#include <throw_allocator.h>`

Inherits **std::exception**.

### Public Member Functions

virtual const char \* **what** () const noexcept\

## Detailed Description

Thrown by utilities for testing exception safety.

## Member Function Documentation

### virtual const char \* std::exception::what () const` [virtual]`, ` [noexcept]`, ` [inherited]`

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

Reimplemented in **std::ios\_base::failure**, **std::bad\_alloc**, **std::bad\_any\_cast**, **std::filesystem::filesystem\_error**, **std::bad\_weak\_ptr**, **std::bad\_function\_call**, **std::experimental::fundamentals\_v1::bad\_any\_cast**, **std::experimental::filesystem::v1::filesystem\_error**, **std::future\_error**, **std::logic\_error**, **std::runtime\_error**, **std::bad\_exception**, **std::bad\_cast**, **std::bad\_typeid**, and **std::bad\_optional\_access**.

## Author

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