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

### 3160. `atomic_ref() = delete;` should be deleted

Section: 31.7 [atomics.ref.generic] Status: C++20 Submitter: Tim Song Opened: 2018-10-01 Last modified: 2021-02-25

Priority: 0

View all other issues in [atomics.ref.generic].

View all issues with C++20 status.

Discussion:

`atomic_ref` has a deleted default constructor, which causes pointless ambiguities in cases like:

>     void meow(atomic_ref<int>);
>     void meow(some_default_constructible_struct);

>     meow({});

It should have no default constructor rather than a deleted one. (Note that it has other user-defined constructors and so cannot be an aggregate under any definition.)

[2018-10-06 Status to Tentatively Ready after seven positive votes on the reflector.]

[2018-11, Adopted in San Diego]

Proposed resolution:

This wording is relative to N4762.

- Edit 31.7 [atomics.ref.generic], class template `atomic_ref` synopsis, as indicated:

  >     […]
  >     atomic_ref() = delete;
  >     atomic_ref& operator=(const atomic_ref&) = delete;
  >     […]

- Edit 31.7.3 [atomics.ref.int], class template specialization `atomic_ref<integral>` synopsis, as indicated:

  >     […]
  >     atomic_ref() = delete;
  >     atomic_ref& operator=(const atomic_ref&) = delete;
  >     […]

- Edit 31.7.4 [atomics.ref.float], class template specialization `atomic_ref<floating-point>` synopsis, as indicated:

  >     […]
  >     atomic_ref() = delete;
  >     atomic_ref& operator=(const atomic_ref&) = delete;
  >     […]

- Edit 31.7.5 [atomics.ref.pointer], class template specialization `atomic_ref<T*>` synopsis, as indicated:

  >     […]
  >     atomic_ref() = delete;
  >     atomic_ref& operator=(const atomic_ref&) = delete;
  >     […]