GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
c++

Implement C++29 P3950R1 for coroutines return values.

GCC now implements C++29 P3950R1, clarifying that coroutine return_value and return_void are not mutually exclusive.

GCC now implements C++29 paper P3950R1, which clarifies that the return_value and return_void promise members in C++ coroutines are not mutually exclusive. This change removes diagnostics that previously flagged errors when both return_void and return_value could be successfully looked up. The __cpp_impl_coroutine macro has been updated to reflect the C++29 standard version, and tests have been adjusted accordingly.

In Details

Implements C++29 P3950R1 (DR for stmt.return.coroutine#3) by removing the diagnostic that fired when both p.return_void() and p.return_value() were successfully found during overload resolution for coroutine return statements. The coroutine_info struct no longer tracks coro_co_return_error_emitted. The lookup_promise_method and coro_build_promise_expression functions now accept a complain argument to control error reporting when overload resolution fails, aligning with the standard's allowance for both methods to exist.

For Context
C++ coroutines
A C++ language feature (introduced in C++20) that allows functions to suspend execution and resume later, enabling asynchronous programming patterns.
promise type
A type associated with a coroutine that manages its execution, including its suspension, resumption, and return value.
return_value
A specific member function within a coroutine's promise type that is called to set the coroutine's return value.
return_void
A specific member function within a coroutine's promise type that is called when a coroutine returns without a value.
P3950R1
A C++ proposal document (likely a Defect Report or a technical clarification) addressing the interaction between return_value and return_void in C++ coroutines.
__cpp_impl_coroutine
A predefined macro that indicates the level of C++ coroutine support implemented by the compiler. Its value reflects the standard version and feature set.
Filed Under: c++coroutinesstandardizationcompiler