Skip to content

Commit 3b16057

Browse files
committed
New issue from Jiang An: "SFINAE-friendliness on operator<< and operator>> for unspecified I/O manipulators"
1 parent ab8a8ef commit 3b16057

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

xml/issue4364.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4364" status="New">
5+
<title>SFINAE-friendliness on <tt>operator&lt;&lt;</tt> and <tt>operator&gt;&gt;</tt> for unspecified I/O manipulators</title>
6+
<section>
7+
<sref ref="[std.manip]"/><sref ref="[ext.manip]"/><sref ref="[quoted.manip]"/>
8+
</section>
9+
<submitter>Jiang An</submitter>
10+
<date>05 Sep 2025</date>
11+
<priority>99</priority>
12+
13+
<discussion>
14+
<p>
15+
Currently, it is unspecified whether any of <tt>operator&lt;&lt;</tt> or <tt>operator&gt;&gt;</tt>
16+
for the "<i>unspecified</i>" return type of an I/O manipulating function is SFINAE-friendly.
17+
<p/>
18+
There's implementation divergence. E.g. the following program is consistently rejected by
19+
implementations although the standard doesn't strictly require it to be ill-formed. Among
20+
the implementations, libstdc++ and libc++ make the failure SFINAE-friendly, while MSVC STL
21+
doesn't (<a href="https://godbolt.org/z/rWYszoYa8">demo</a>):
22+
</p>
23+
<blockquote><pre>
24+
#include &lt;iostream&gt;
25+
#include &lt;iomanip&gt;
26+
27+
int main()
28+
{
29+
std::cout &lt;&lt; std::setfill(L'*');
30+
}
31+
</pre></blockquote>
32+
<p>
33+
It seems better to eliminate such implementation divergence. Perhaps it's also better to
34+
require them to be SFINAE-friendly to reduce potential conflicts with user-provided operators.
35+
<p/>
36+
If it's intended to allow implementation divergence, perhaps we should clarify the intent.
37+
</p>
38+
</discussion>
39+
40+
<resolution>
41+
</resolution>
42+
43+
</issue>

0 commit comments

Comments
 (0)