This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of TC1 status.

### 108. Lifetime of exception::what() return unspecified

Section: 17.7.3 [type.info] Status: TC1 Submitter: AFNOR Opened: 1998-10-07 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [type.info].

View all issues with TC1 status.

Discussion:

In 18.6.1, paragraphs 8-9, the lifetime of the return value of exception::what() is left unspecified. This issue has implications with exception safety of exception handling: some exceptions should not throw bad_alloc.

Proposed resolution:

Add to 17.7.3 [type.info] paragraph 9 (exception::what notes clause) the sentence:

> The return value remains valid until the exception object from which it is obtained is destroyed or a non-const member function of the exception object is called.

Rationale:

If an exception object has non-const members, they may be used to set internal state that should affect the contents of the string returned by `what()`.