Created on 2025-05-24.00:00:00 last changed 1 month ago
Proposed resolution:
This wording is relative to N5014.
Modify [tuple.cnstr] as indicated:
template<class Alloc> constexpr explicit(see below) tuple(allocator_arg_t, const Alloc& a); […] template<class Alloc, tuple-like UTuple> constexpr explicit(see below) tuple(allocator_arg_t, const Alloc& a, UTuple&&);-32- Preconditions: `Alloc` meets the Cpp17Allocator requirements ([allocator.requirements.general]).
-33- Effects: Equivalent to the preceding constructors except that each element of non-reference type is constructed with uses-allocator construction ([allocator.uses.construction]).
[ 2025-10-15; Jonathan provides new wording ]
I don't think we care about uses-allocator construction of references in general. You can't construct a reference using `allocator_traits::construct` nor put references in containers. For a `std::pair` containing a reference, I think `make_obj_using_allocator` and `uses_allocator_construction_args` work fine. The problem only exists in the `std::tuple` wording where we say that the elements are constructed using uses-allocator construction. So let's just fix that.
[ 2025-10-14; Reflector poll ]
Set priority to 3 after reflector poll.
"There is a defect, but the right fix is to just define uses-allocator construction of references as equivalent to normal construction."
This wording is relative to N5008.
Modify [tuple.cnstr] as indicated:
template<class Alloc> constexpr explicit(see below) tuple(allocator_arg_t, const Alloc& a); […] template<class Alloc, tuple-like UTuple> constexpr explicit(see below) tuple(allocator_arg_t, const Alloc& a, UTuple&&);-32- Preconditions: `Alloc` meets the Cpp17Allocator requirements ([allocator.requirements.general]).
-33- Effects: Equivalent to the preceding constructors except that each element is constructed with uses-allocator construction ([allocator.uses.construction]). -?- Remarks: These constructors are defined as deleted if is_reference_v<Ti> is `true` for at least one Ti.
Per [allocator.uses.construction]/1, uses-allocator construction is only defined for objects. And presumably, an attempt to construct `std::tuple` of reference from an `allocator_arg_t` constructor causes a hard error.
Since C++23/P2255R2, it seems that these `allocator_arg_t` constructors are conditionally deleted according to [tuple.cnstr]/33. However, it's confusing that these constructors are sometimes non-deleted when the tuple contains a reference, while there are hard errors in an instantiation instead.| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2025-10-16 11:35:46 | admin | set | messages: + msg15179 |
| 2025-10-14 21:30:14 | admin | set | messages: + msg15167 |
| 2025-05-24 10:55:43 | admin | set | messages: + msg14770 |
| 2025-05-24 00:00:00 | admin | create | |