---
name: "std::runtime_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/std::runtime_error/3cxx"
---

# std::runtime\_error(3cxx)

One of two subclasses of exception.

## NAME

std::runtime\_error - One of two subclasses of exception.

## SYNOPSIS

`#include <stdexcept>`

Inherits **std::exception**.

Inherited by **std::overflow\_error**, **std::range\_error**, **std::regex\_error**, **std::system\_error**, and **std::underflow\_error**.

### Public Member Functions

**runtime\_error** (const char \*) \_GLIBCXX\_TXN\_SAFE\
 **runtime\_error** (const **runtime\_error** &)=**default**\
 **runtime\_error** (const **string** &\_\_arg) \_GLIBCXX\_TXN\_SAFE\
 **runtime\_error** (**runtime\_error** &&) noexcept\
 **runtime\_error** & **operator=** (const **runtime\_error** &)=**default**\
 **runtime\_error** & **operator=** (**runtime\_error** &&) noexcept\
 **virtual** const char \* **what** () const noexcept\

## Detailed Description

One of two subclasses of exception.

Runtime errors represent problems outside the scope of a program; they cannot be easily predicted and can generally only be caught as the program executes.

## Constructor & Destructor Documentation

### std::runtime\_error::runtime\_error (const string & \_\_arg)` [explicit]`

Takes a character string describing the error. \

## Member Function Documentation

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

Returns a C-style character string describing the general cause of the current error (the same string passed to the ctor). \

Reimplemented from **std::exception**.

Reimplemented in **std::filesystem::filesystem\_error**, and **std::experimental::filesystem::v1::filesystem\_error**.

## Author

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