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

### 3745. `std::atomic_wait` and its friends lack `noexcept`

Section: 33.5.2 [atomics.syn] Status: WP Submitter: Jiang An Opened: 2022-07-25 Last modified: 2022-11-17

Priority: Not Prioritized

View other active issues in [atomics.syn].

View all other issues in [atomics.syn].

View all issues with WP status.

Discussion:

Currently function templates `std::atomic_wait`, `std::atomic_wait_explicit`, `std::atomic_notify_one`, and `std::atomic_notify_all` are not `noexcept` in the Working Draft, but the equivalent member functions are all `noexcept`. I think these function templates should be specified as `noexcept`, in order to be consistent with the `std::atomic_flag_*` free functions, the corresponding member functions, and other `std::atomic_*` function templates.

Mainstream implementations (libc++, libstdc++, and MSVC STL) have already added `noexcept` to them.

[2022-07-30; Daniel provides wording]

[2022-08-23; Reflector poll]

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

"Technically there's a difference between these and the member functions - the pointer can be null - but we don't seem to have let that stop us from adding noexcept to the rest of these functions."

[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4910.

1. Modify 33.5.2 [atomics.syn], header `<atomic>` synopsis, as indicated:

   >     […]
   >     template<class T>
   >       void atomic_wait(const volatile atomic<T>*, typename atomic<T>::value_type) noexcept;
   >     template<class T>
   >       void atomic_wait(const atomic<T>*, typename atomic<T>::value_type) noexcept;
   >     template<class T>
   >       void atomic_wait_explicit(const volatile atomic<T>*, typename atomic<T>::value_type,
   >                                 memory_order) noexcept;
   >     template<class T>
   >       void atomic_wait_explicit(const atomic<T>*, typename atomic<T>::value_type,
   >                                 memory_order) noexcept;
   >     template<class T>
   >       void atomic_notify_one(volatile atomic<T>*) noexcept;
   >     template<class T>
   >       void atomic_notify_one(atomic<T>*) noexcept;
   >     template<class T>
   >       void atomic_notify_all(volatile atomic<T>*) noexcept;
   >     template<class T>
   >       void atomic_notify_all(atomic<T>*) noexcept;
   >     […]