<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 - [coroutines] Clang should not consider use of co_await within a move/copy-assignment operator as ill-formed"
href="https://bugs.llvm.org/show_bug.cgi?id=40997">40997</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[coroutines] Clang should not consider use of co_await within a move/copy-assignment operator as ill-formed
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>C++2a
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>lewissbaker@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>From <a href="https://reviews.llvm.org/D59076?id=189653#inline-522719">https://reviews.llvm.org/D59076?id=189653#inline-522719</a>
Clang currently raises an error if any special member function is compiled as a
coroutine. This includes constructors, destructors as well as copy/move
assignment operators.
However, N4775 only seems to have wording to disallow constructors/destructors
from being coroutines. With wording added to [class.ctor] and [class.dtor] but
no wording is added to [class.copy.assign] to disallow it from being a
coroutine.
See <a href="https://godbolt.org/z/cdhH3l">https://godbolt.org/z/cdhH3l</a>
#include <experimental/coroutine>
using namespace std::experimental;
struct task {
struct promise_type {
suspend_never initial_suspend();
suspend_never final_suspend();
task get_return_object();
void return_void();
void unhandled_exception();
};
};
struct X {
task operator=(const X& other) {
co_return; // ERROR: 'co_return' cannot be used in a copy assignment
operator
}
task operator=(X& other) {
co_return; // ERROR: 'co_return' cannot be used in a copy assignment
operator
}
task operator=(X&& other) {
co_return; // ERROR: 'co_return' cannot be used in a move assignment
operator
}
task operator=(const X&& other) {
co_return; // ERROR: 'co_return' cannot be used in a move assignment
operator
}
task operator=(int x) {
co_return; // OK
}
};
All 5 of these should be accepted according to wording of N4775.</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>