Repository navigation
Open
Description
Discussed in #350
Originally posted by zaides-blackduck October 22, 2026
Issue Summary
when await_resume() returns a reference to a value EDG treats it as an rvalue instead of an lvalue. This generates an error when the returned value is assigned.
The error in the example:
(co_await bool_ref_awaiter{}) = false;
^
Reproducing Source Code
namespace std {
template <typename = void> struct coroutine_handle;
template <> struct coroutine_handle<> { void *address(); };
template <typename> struct coroutine_handle {
static coroutine_handle from_address(void *);
operator coroutine_handle<>() noexcept;
};
template <typename R, typename...> struct coroutine_traits {
using promise_type = typename R::promise_type;
};
} // namespace std
struct suspend {
bool await_ready() noexcept;
void await_suspend(std::coroutine_handle<>) noexcept;
void await_resume() noexcept;
};
struct bool_ref_awaiter {
bool await_ready() noexcept;
void await_suspend(std::coroutine_handle<>) noexcept;
bool &await_resume() noexcept;
};
struct task;
struct promise {
suspend initial_suspend() noexcept;
suspend final_suspend() noexcept;
void return_void();
void unhandled_exception();
task get_return_object();
};
struct task {
using promise_type = promise;
};
task f() {
(co_await bool_ref_awaiter{}) = false;
}
Command-line Options
cafe --c++23 test.cpp
Type of Issue
[Front End] This code SHOULD compile with these options.
Additional Details
Runs well with Clang 20 and gcc 15
Reproducing (Standard) Configuration(s)
No response
Reproducing (Non-standard) Configuration
No response
I acknowledge that:
- I have checked open issues and existing discussions before filing this report.
- The reproducing source code that I have provided does not depend on headers that I have not included with my submission.
- I have reduced the reproducing source code to the best of my ability.
- I have selected at least one standard configuration or uploaded a non-standard configuration dump.
- I understand code shared via this form is NOT confidential.
- I have permission to share the reproducing source code and grant permission for the project to use the source code (or derivatives of the source code) to create tests.
- I agree that any tests created using the reproducing source code (or deriatives of it) will be licensed under project license unless I included a
LICENSE.txtfile in my.zipor.tar.gzupload. If I included aLICENSE.txtfile, any tests created using the reproducing source code will be governed by the terms of the license I provided instead.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Parenthesize a co_await operand when needed; update gnats 21769. [GH e…
Parenthesize a comma operand of co_yield in generated C++. [GH edgcpp…
Use the CI output for the gnats 21769 recording. [GH edgcpp#447]
warn-unsequenced-coro now passes in the C++-generating configs. [GH e…
Move the C++ back-end parenthesization changes to a separate PR. [GH e…
Give co_await the value category of await_resume(). [GH edgcpp#447]
Do not clone a folded co_await operand for await_suspend. [GH edgcpp#447
Give co_await the value category of await_resume(). [GH edgcpp#447]
Do not clone a folded co_await operand for await_suspend. [GH edgcpp#447
Use the folded flag of the co_await calls; handle function references…