P3936R1 — Safer atomic_ref::address (FR-030-310) (8 items) LWG
Corentin Jabot, Gonzalo Brito Gadeschi
This paper proposes changing the return type of atomic_ref::address() from T* to void* (with CV-qualifiers preserved via an exposition-only alias) to resolve NB comment FR-030-310. Returning void* prevents accidental unsafe direct access to the underlying object while atomic_ref instances are live, while still allowing explicit casts to recover the original pointer type. The approach is now viable for constant evaluation because P2738R1 made void*-to-T* casts valid in constexpr contexts in C++26.

References — Anthropic Citations API

[1]
"These observation were made in the original paper. "
[2]
"However, EWG had no appetite to do it in the C++26 time frame (over concernns that there might exist architectures in which pointers can be larger than the largest integer type). "
[3]
"The only downsize of using void* is then a slightly more complicated return type. "
[4]
"• It addresses the concerns over missuse and safety: the void* pointer can be compared, hashed, etc without issue, but accessing the underlying object requires an explicit cast. "
[5]
"[Editor's note: Modify in the synopsys]"
[6]
"This function was added by P2835R7 [1], which cover the use cases for this function."
[7]
"? General [atomics.ref.generic.general] [Editor’s note: Modify in the synopsys] using value_type = remove_cv_t; using address-return-type = COPYCV(T, void)*; //expos static constexpr..."
[7]
"? General [atomics.ref.generic.general] [Editor’s note: Modify in the synopsys] using value_type = remove_cv_t; using address-return-type = COPYCV(T, void)*; //expos static constexpr..."
[8]
"[N5008] Thomas Köppe Working Draft, Standard for Programming Language C++ https://wg21.link/N5008"
Summary: P3936R1 proposes changing the return type of atomic_ref::address() from T* to void* to address safety concerns about accidental misuse of the returned pointer for non-atomic operations. It modifies the wording in [atomics.ref.generic.general] and the integer, floating-point, and pointer specializations accordingly.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.