P3936R1 — Safer atomic_ref::address (FR-030-310)
(8 items)
LWG
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.
- Wording, [atomics.ref.generic.general] (page 2) vs [atomics.ref.int], [atomics.ref.float], [atomics.ref.pointer] (page 3) — Inconsistent exposition-only comment: the generic template uses //expos while all three specializations use //exposition only. The standard convention is // exposition only. [5] [1]
- Wording, [atomics.ref.generic.general], [atomics.ref.int], [atomics.ref.float], [atomics.ref.pointer] (pages 2-3) — "synopsys" misspelled in all four editor's notes; should be "synopsis." [2]
- Motivation, page 2 — "downsize" is the wrong word; intended meaning is "downside" (disadvantage). [3] [3]
- Motivation, page 1 — Subject-verb disagreement: "These observation" should be "These observations." [1] [4]
- Motivation, page 1 — Subject-verb disagreement: "which cover" refers to the singular antecedent "P2835R7"; should be "which covers." [5]
- Motivation, page 2 — "concernns" misspelled; should be "concerns." [2] [6]
- Motivation, page 2 — "missuse" misspelled; should be "misuse." [4] [7]
- References, page 4 — Bibliography entry [N5008] missing period between author name and title, inconsistent with the other two entries. [8]
References — Anthropic Citations API
[1]
"These observation were made in the original paper. "
"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). "
"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. "
"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. "
"• 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]"
"[Editor's note: Modify in the synopsys]"
[6]
"This function was added by P2835R7 [1], which cover the use cases for this function."
"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..."
"? General [atomics.ref.generic.general] [Editor’s note: Modify in the synopsys] using value_type = remove_cv_t
[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..."
"? General [atomics.ref.generic.general] [Editor’s note: Modify in the synopsys] using value_type = remove_cv_t
[8]
"[N5008] Thomas Köppe Working Draft, Standard for Programming Language C++ https://wg21.link/N5008"
"[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.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.