c++: co_await and initializer_list [PR109227]
commit44868e7298de5048d6f04d7fa098d5bc767c8cb8
authorJason Merrill <jason@redhat.com>
Thu, 25 Jan 2024 19:45:35 +0000 (25 14:45 -0500)
committerJason Merrill <jason@redhat.com>
Thu, 25 Jan 2024 20:22:32 +0000 (25 15:22 -0500)
treee1a48f2d8d563113d1c9d54114d1f3e76fd2e8e5
parentf03b8f595b6350732bb0a9a69557c5ed2af085b2
c++: co_await and initializer_list [PR109227]

Here we end up with an initializer_list of 'aa', a type with a non-trivial
destructor, and need to destroy it.  The code called
build_special_member_call for cleanups, but that doesn't work for arrays, so
use cxx_maybe_build_cleanup instead.  Let's go ahead and do that
everywhere that has been calling the destructor directly.

PR c++/109227

gcc/cp/ChangeLog:

* coroutines.cc (build_co_await): Use cxx_maybe_build_cleanup.
(build_actor_fn, process_conditional, maybe_promote_temps)
(morph_fn_to_coro): Likewise.
(expand_one_await_expression): Use build_cleanup.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/co-await-initlist2.C: New test.
gcc/cp/coroutines.cc
gcc/testsuite/g++.dg/coroutines/co-await-initlist2.C [new file with mode: 0644]