Title
Const and value category mismatch for `allocator_arg_t`/`allocator_arg` in the description of uses-allocator construction
Status
new
Section
[allocator.uses.construction]
Submitter
Jiang An

Created on 2025-08-06.00:00:00 last changed 3 weeks ago

Messages

Date: 2025-08-16.09:29:49

Proposed resolution:

This wording is relative to N5014.

  1. Modify [allocator.uses.construction] as indicated:

    -2- The following utility functions support three conventions for passing `alloc` to a constructor:

    1. (2.1) — […]

    2. (2.2) — Otherwise, if `T` has a constructor invocable as T(allocator_argallocator_arg_t{}, alloc, args...) (leading-allocator convention), then uses-allocator construction chooses this constructor form.

    3. (2.3) — […]

Date: 2025-08-06.00:00:00

Currently, [allocator.uses.construction] bullet 2.2 states:

Otherwise, if `T` has a constructor invocable as `T(allocator_arg, alloc, args...)` (leading-allocator convention), […]

However, when forming construction arguments in the utility functions, we're actually using cv-unqualified rvalue of `allocator_arg_t`, which can be inferred from using plain `allocator_arg_t` but not const allocator_arg_t& in [allocator.uses.construction] bullet 5.2.

It seems that such mismatch was present even since C++11 (per N3337 [allocator.uses.construction]/1.2). If the use of plain `allocator_arg_t` is considered correct, I think we should fix the description.

History
Date User Action Args
2025-08-09 17:03:03adminsetmessages: + msg14929
2025-08-06 00:00:00admincreate