Skip to content

Commit a2a6a61

Browse files
committed
New issue from Jiang An: "regex_traits::transform_primary mistakenly detects typeid of a function"
1 parent 7c99fc8 commit a2a6a61

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

xml/issue4186.xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4186" status="New">
5+
<title>`regex_traits::transform_primary` mistakenly detects `typeid` of a function</title>
6+
<section><sref ref="[re.traits]"/></section>
7+
<submitter>Jiang An</submitter>
8+
<date>18 Dec 2024</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
<sref ref="[re.traits]"/>/7 currently says <tt>typeid(use_facet&lt;collate&lt;charT&gt;&gt;) ==
14+
typeid(collate_byname&lt;charT&gt;)</tt>, which is always `false` because
15+
<tt>use_facet&lt;collate&lt;charT&gt;&gt;</tt> is a function template specialization while
16+
<tt>collate_byname&lt;charT&gt;</tt> is a class template specialization. This looks like
17+
misuse, and has been present in TR1 (<paper num="N1836"/>).
18+
<p/>
19+
Presumably the intended operand is <tt>use_facet&lt;collate&lt;charT&gt;&gt;(getloc())</tt>.
20+
</p>
21+
</discussion>
22+
23+
<resolution>
24+
<p>
25+
This wording is relative to <paper num="N5001"/>.
26+
</p>
27+
28+
<ol>
29+
<li><p>Modify <sref ref="[re.traits]"/> as indicated:</p>
30+
31+
<blockquote>
32+
<pre>
33+
template&lt;class ForwardIterator&gt;
34+
string_type transform_primary(ForwardIterator first, ForwardIterator last) const;
35+
</pre>
36+
<blockquote>
37+
<p>
38+
-7- <i>Effects</i>: If
39+
</p>
40+
<blockquote><pre>
41+
typeid(use_facet&lt;collate&lt;charT&gt;&gt;<ins>(getloc())</ins>) == typeid(collate_byname&lt;charT&gt;)
42+
</pre></blockquote>
43+
<p>
44+
and the form of the sort key returned by <tt>collate_byname&lt;charT&gt;::transform(first, last)</tt>
45+
is known and can be converted into a primary sort key then returns that key, otherwise returns an empty
46+
string.
47+
</p>
48+
</blockquote>
49+
</blockquote>
50+
51+
52+
</li>
53+
54+
</ol>
55+
</resolution>
56+
57+
</issue>

0 commit comments

Comments
 (0)