Skip to content

Commit 4ae1c00

Browse files
committed
New issue from Jiang An: "Uses-allocator construction is meaningless for tuple of references"
1 parent c6ab69d commit 4ae1c00

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

xml/issue4267.xml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4267" status="New">
5+
<title>Uses-allocator construction is meaningless for tuple of references</title>
6+
<section><sref ref="[tuple.cnstr]"/></section>
7+
<submitter>Jiang An</submitter>
8+
<date>24 May 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
Per <sref ref="[allocator.uses.construction]"/>/1, uses-allocator construction is only defined for objects.
14+
And presumably, an attempt to construct `std::tuple` of reference from an `allocator_arg_t` constructor
15+
causes a hard error.
16+
<p/>
17+
Since C++23/<paper num="P2255R2"/>, it seems that these `allocator_arg_t` constructors are conditionally
18+
deleted according to <sref ref="[tuple.cnstr]"/>/33. However, it's confusing that these constructors are
19+
sometimes non-deleted when the tuple contains a reference, while there are hard errors in an instantiation
20+
instead.
21+
</p>
22+
</discussion>
23+
24+
<resolution>
25+
<p>
26+
This wording is relative to <paper num="N5008"/>.
27+
</p>
28+
<ol>
29+
30+
<li><p>Modify <sref ref="[tuple.cnstr]"/> as indicated:</p>
31+
32+
<blockquote>
33+
<pre>
34+
template&lt;class Alloc&gt;
35+
constexpr explicit(<i>see below</i>)
36+
tuple(allocator_arg_t, const Alloc&amp; a);
37+
[&hellip;]
38+
template&lt;class Alloc, tuple-like UTuple&gt;
39+
constexpr explicit(<i>see below</i>)
40+
tuple(allocator_arg_t, const Alloc&amp; a, UTuple&amp;&amp;);
41+
</pre>
42+
<blockquote>
43+
<p>
44+
-32- <i>Preconditions</i>: `Alloc` meets the <i>Cpp17Allocator</i> requirements (<sref ref="[allocator.requirements.general]"/>).
45+
<p/>
46+
-33- <i>Effects</i>: Equivalent to the preceding constructors except that each element is constructed with uses-allocator
47+
construction (<sref ref="[allocator.uses.construction]"/>).
48+
<p/>
49+
<ins>-?- <i>Remarks</i>: These constructors are defined as deleted if <tt>is_reference_v&lt;T<sub><i>i</i></sub>&gt;</tt>
50+
is `true` for at least one <tt>T<sub><i>i</i></sub></tt>.</ins>
51+
</p>
52+
</blockquote>
53+
</blockquote>
54+
55+
</li>
56+
57+
</ol>
58+
59+
</resolution>
60+
61+
</issue>

0 commit comments

Comments
 (0)