if (TREE_CODE (*stmt) == CO_AWAIT_EXPR)
{
*dosub = 0; /* We don't need to consider this any further. */
- tree **p = (tree **) d;
- *p = stmt;
+ if (d)
+ *(tree **)d = stmt;
return *stmt;
}
return NULL_TREE;
bool already_present = promoted->add (var);
gcc_checking_assert (!already_present);
tree inner = TARGET_EXPR_INITIAL (init);
- gcc_checking_assert (TREE_CODE (inner) != COND_EXPR);
+ gcc_checking_assert
+ (TREE_CODE (inner) != COND_EXPR
+ || !cp_walk_tree (&inner, find_any_await, nullptr, nullptr));
init = cp_build_modify_expr (input_location, var, INIT_EXPR, init,
tf_warning_or_error);
/* Simplify for the case that we have an init containing the temp
--- /dev/null
+// PR 109283.
+// This used to ICE from a check set too widely.
+#include <coroutine>
+
+struct foo
+{ ~foo(); };
+
+struct task
+{
+ struct promise_type
+ {
+ std::suspend_never initial_suspend();
+ std::suspend_never final_suspend() noexcept;
+ std::suspend_never yield_value(foo);
+ void return_void();
+ void unhandled_exception();
+ task get_return_object();
+ };
+};
+
+task source(int b) {
+ co_yield b ? foo{} : foo{};
+}