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 [] Status: TC1 Submitter: AFNOR Opened: 1998-10-07 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [].

View all issues with TC1 status.


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 [] 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.


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().