<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Incorrect implementation of LWG 2534"
href="https://bugs.llvm.org/show_bug.cgi?id=32963">32963</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect implementation of LWG 2534
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zilla@kayari.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>#include <iostream>
int main()
{
std::ostream& os = std::move(std::cout) << "<a href="http://wg21.link/lwg2534">http://wg21.link/lwg2534</a>";
os << '\n';
}
prog.cc:5:19: error: non-const lvalue reference to type 'basic_ostream<...>'
cannot bind to a temporary of type 'basic_ostream<...>'
std::ostream& os = std::move(std::cout) << "<a href="http://wg21.link/lwg2534">http://wg21.link/lwg2534</a>";
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The return type should be an lvalue reference.
The SFINAE constraint on the operator<< for rvalue streams also seem wrong.
This shouldn't compile because the constraint is not met:
#include <ostream>
struct X : std::ios_base { };
struct Y { };
template<typename T, typename U, typename = void>
struct is_streamable
: std::false_type { };
template<typename T, typename U>
struct is_streamable<T, U, decltype(void(), std::declval<T>() <<
std::declval<U>())>
: std::true_type { };
static_assert( !is_streamable<X, Y>::value, "" );
decltype(std::declval<X>() << std::declval<Y>()) f();
const auto& ff = f();</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>