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

### 2287. [fund.ts] Incorrect exception safety for `optional` copy assignment operator

Section: 5.3.3 [fund.ts::optional.object.assign] Status: Resolved Submitter: Howard Hinnant Opened: 2013-08-16 Last modified: 2015-10-26

Priority: Not Prioritized

View all other issues in [fund.ts::optional.object.assign].

View all issues with Resolved status.

Discussion:

Addresses: fund.ts

The Exception safety paragraph of 5.3.3 [fund.ts::optional.object.assign] calls out `T`'s copy constructor when it should refer to `T`'s copy assignment operator.

[2013-09 Chicago:]

Move to Deferred. This feature will ship after C++14 and should be revisited then.

[2014-06-06 pre-Rapperswill]

This issue has been reopened as fundamentals-ts.

[2014-06-07 Daniel comments]

This issue should be set to Resolved, because the wording fix is already applied in the last fundamentals working draft.

[2014-06-16 Rapperswill]

Confirmed that this issue is resolved in the current Library Fundamentals working paper.

Proposed resolution:

This wording is relative to N3691.

1. Change 5.3.3 [fund.ts::optional.object.assign] as indicated:

   >     optional<T>& operator=(const optional<T>& rhs);

   > > […]

   > > -8- Exception safety: If any exception is thrown, the values of `init` and `rhs.init` remain unchanged. If an exception is thrown during the call to `T`'s copy constructor, no effect. If an exception is thrown during the call to `T`'s copy assignment, the state of its contained value is as defined by the exception safety guarantee of `T`'s copy constructor assignment.