|
| 1 | +<?xml version='1.0' encoding='utf-8' standalone='no'?> |
| 2 | +<!DOCTYPE issue SYSTEM "lwg-issue.dtd"> |
| 3 | + |
| 4 | +<issue num="4312" status="New"> |
| 5 | +<title>Const and value category mismatch for `allocator_arg_t`/`allocator_arg` in the description |
| 6 | +of uses-allocator construction</title> |
| 7 | +<section> |
| 8 | +<sref ref="[allocator.uses.construction]"/> |
| 9 | +</section> |
| 10 | +<submitter>Jiang An</submitter> |
| 11 | +<date>06 Aug 2025</date> |
| 12 | +<priority>99</priority> |
| 13 | + |
| 14 | +<discussion> |
| 15 | +<p> |
| 16 | +Currently, <sref ref="[allocator.uses.construction]"/> bullet 2.2 states: |
| 17 | +</p> |
| 18 | +<blockquote><p> |
| 19 | +Otherwise, if `T` has a constructor invocable as `T(allocator_arg, alloc, args...)` (leading-allocator convention), |
| 20 | +[…] |
| 21 | +</p></blockquote> |
| 22 | +<p> |
| 23 | +However, when forming construction arguments in the utility functions, we're actually using <i>cv</i>-unqualified |
| 24 | +rvalue of `allocator_arg_t`, which can be inferred from using plain `allocator_arg_t` but not |
| 25 | +<tt>const allocator_arg_t&</tt> in <sref ref="[allocator.uses.construction]"/> bullet 5.2. |
| 26 | +<p/> |
| 27 | +It seems that such mismatch was present even since C++11 (per <paper num="N3337"/> [allocator.uses.construction]/1.2). |
| 28 | +If the use of plain `allocator_arg_t` is considered correct, I think we should fix the description. |
| 29 | +</p> |
| 30 | +</discussion> |
| 31 | + |
| 32 | +<resolution> |
| 33 | +<p> |
| 34 | +This wording is relative to this |
| 35 | +<a href="https://github.com/cplusplus/draft/actions/runs/16749320058/artifacts/3690555293">CD preview draft</a>. |
| 36 | +</p> |
| 37 | + |
| 38 | +<ol> |
| 39 | + |
| 40 | +<li><p>Modify <sref ref="[allocator.uses.construction]"/> as indicated:</p> |
| 41 | + |
| 42 | +<blockquote> |
| 43 | +<p> |
| 44 | +-2- The following utility functions support three conventions for passing `alloc` to a constructor: |
| 45 | +</p> |
| 46 | +<ol style="list-style-type: none"> |
| 47 | +<li><p>(2.1) — […]</p></li> |
| 48 | +<li><p>(2.2) — Otherwise, if `T` has a constructor invocable as |
| 49 | +<tt>T(<del>allocator_arg</del><ins>allocator_arg_t{}</ins>, alloc, args...)</tt> |
| 50 | +(leading-allocator convention), then uses-allocator construction chooses this constructor form.</p></li> |
| 51 | +<li><p>(2.3) — […]</p></li> |
| 52 | +</ol> |
| 53 | +</blockquote> |
| 54 | + |
| 55 | +</li> |
| 56 | + |
| 57 | +</ol> |
| 58 | +</resolution> |
| 59 | + |
| 60 | +</issue> |
0 commit comments