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

2073. Library exceptions that take string arguments

Section: 19.2 [std.exceptions], 19.5.8 [syserr.syserr], 31.5.2.2.1 [ios.failure] Status: NAD Submitter: Eelis van der Weegen Opened: 2011-08-16 Last modified: 2023-02-07

Priority: Not Prioritized

View all other issues in [std.exceptions].

View all issues with NAD status.

Discussion:

This is an extension issue for LWG to add constructor overloads that take a string by an rvalue reference in order to move the string into the exception.

[2012, Kona]

Move to NAD.

This was discussed during C++11 standardization, and deemed (at the time) to be a conforming extension that vendors are free to add, but there seemed no need to call it out in the standard. Since then it has been noted that the rvalue-reference overloads do not give you the move-semantic guarantee the proposer is thought to be looking for, as in order to meet the requirements that copy constructors do not throw (for standard exceptions) the exceptions that store strings must actually store a reference-counted immutable string, rather than an std::string internally. Therefore, an rvalue-reference overload is going to have to allocate memory in exactly the same way as copying from a const string& argument.

Proposed resolution: