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

4599. Pointless std-atomic alias template

Section: 32.5.12 [stdatomic.h.syn] Status: New Submitter: Jan Schultke Opened: 2026-06-18 Last modified: 2026-09-10

Priority: 4

View all other issues in [stdatomic.h.syn].

View all issues with New status.

Discussion:

Consider the following example:

#include <stdatomic.h>

struct _Atomic(int) x; // MSVC rejects, GCC and Clang accept

GCC and Clang incorrectly accept this example because they expand the _Atomic macro directly to std::atomic instead of the exposition-only std-atomic alias template (32.5.12 [stdatomic.h.syn]), which allows the use of a preceding struct keyword.

While the wording is clear, the exposition-only std-atomic alias template causes disagreement among implementers (see discussion at here and here). P0943R6 never actually intended for an alias template to exist as part of its design. The alias template is intended to hint that the expansion of the _Atomic macro to std::atomic does not require an inclusion of the <atomic> header.

However, std::atomic still appears directly inside the <stdatomic.h> synopsis, so it is unclear how std-atomic contributes to that goal.

[2026-08-27; Reflector poll.]

Set priority to 4 after reflector poll.

Many voted NAD, arguing the alias template serves a purpose (prevents lookup problems in nested namespaces and communicates that std::atomic need not be visible from <stdatomic.h>).

Possible improvement would be to use:

template<class T>
  using std-atomic = see below;
and then say that it's an unspecified type alias that denotes the same type as std::atomic<T>.

Proposed resolution:

This wording is relative to N5046.

  1. Modify 32.5.12 [stdatomic.h.syn], header <stdatomic.h> synopsis, as indicated:

    template<class T>
      using std-atomic = std::atomic<T>; // exposition only
    
    #define _Atomic(T) std-atomic<T>std::atomic<T>;