Summary:
The coroutine machinery attempts to process non-dependent
coroutine expressions at template definition time. That's just wrong.
@@ -1153,7 +1153,7 @@ finish_co_await_expr (location_t kw, tree expr)
/* If we don't know the promise type, we can't proceed, build the
co_await with the expression unchanged. */
tree functype = TREE_TYPE (current_function_decl);
- if (dependent_type_p (functype) || type_dependent_expression_p (expr))
+ if (processing_template_decl)
return build5_loc (kw, CO_AWAIT_EXPR, unknown_type_node, expr,
NULL_TREE, NULL_TREE, NULL_TREE, integer_zero_node);
@@ -1230,7 +1230,7 @@ finish_co_yield_expr (location_t kw, tree expr)
/* If we don't know the promise type, we can't proceed, build the
co_await with the expression unchanged. */
tree functype = TREE_TYPE (current_function_decl);
- if (dependent_type_p (functype) || type_dependent_expression_p (expr))
+ if (processing_template_decl)
return build2_loc (kw, CO_YIELD_EXPR, unknown_type_node, expr, NULL_TREE);
if (!coro_promise_type_found_p (current_function_decl, kw))
@@ -1316,7 +1316,7 @@ finish_co_return_stmt (location_t kw, tree expr)
/* If we don't know the promise type, we can't proceed, build the
co_return with the expression unchanged. */
tree functype = TREE_TYPE (current_function_decl);
- if (dependent_type_p (functype) || type_dependent_expression_p (expr))
+ if (processing_template_decl)
{
/* co_return expressions are always void type, regardless of the
expression type. */
--
2.30.2