3498. Inconsistent noexcept-specifiers for basic_syncbuf

Section: [syncstream.syncbuf.overview], [syncstream.syncbuf.assign] Status: C++23 Submitter: Jonathan Wakely Opened: 2020-11-10 Last modified: 2023-11-22 15:47:43 UTC

Priority: 3

View all other issues in [syncstream.syncbuf.overview].

View all issues with C++23 status.


The synopsis in [syncstream.syncbuf.overview] shows the move assignment operator and swap member as potentially throwing. The detailed descriptions in [syncstream.syncbuf.assign] are noexcept.


This mismatch is already present in the originally accepted paper P0053R7, so this is nothing that could be resolved editorially.

[2020-11-21; Reflector prioritization]

Set priority to 3 during reflector discussions.

[2021-05-22 Tim adds PR]

The move assignment is specified to call emit() which can throw, and there's nothing in the wording providing for catching/ignoring the exception, so it can't be noexcept. The swap needs to call basic_streambuf::swap, which isn't noexcept, so it shouldn't be noexcept either.

[2021-06-23; Reflector poll]

Set status to Tentatively Ready after eight votes in favour during reflector poll.

[2021-10-14 Approved at October 2021 virtual plenary. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4885.

  1. Modify [syncstream.syncbuf.assign] as indicated:

    basic_syncbuf& operator=(basic_syncbuf&& rhs) noexcept;

    -1- Effects: […]

    -2- Postconditions: […]

    -3- Returns: […]

    -4- Remarks: […]

    void swap(basic_syncbuf& other) noexcept;

    -5- Preconditions: […]

    -6- Effects: […]