---
name: "std::experimental::bad_optional_access"
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::experimental::bad_optional_access/3cxx"
---

# std::experimental::bad\_optional\_access(3cxx)

Exception class thrown when a disengaged optional object is dereferenced.

## NAME

std::experimental::bad\_optional\_access - Exception class thrown when a disengaged optional object is dereferenced.

## SYNOPSIS

`#include <optional>`

Inherits **std::logic\_error**.

### Public Member Functions

**bad\_optional\_access** (const char \*\_\_arg)\
 **virtual** const char \* **what** () const noexcept\

## Detailed Description

Exception class thrown when a disengaged optional object is dereferenced.

## Member Function Documentation

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

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::future\_error**.

## Author

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