<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61508>61508</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Destroying a coroutine suspended in a list-initializer forgets some destructors
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Alcaro
      </td>
    </tr>
</table>

<pre>
    ```c++
#include <coroutine>
#include <memory>

struct simple {
  std::coroutine_handle<void> handle;
 struct promise_type {
    simple get_return_object() { return {std::coroutine_handle<promise_type>::from_promise(*this)}; }
    void return_void() {}
    void unhandled_exception() {}
    auto initial_suspend() noexcept { return std::suspend_never{}; }
    auto final_suspend() noexcept { return std::suspend_never{}; }
 };
};
simple struct_compound_expr() {
    std::unique_ptr<int> k[] = {
        std::make_unique<int>(5),
        (co_await std::suspend_always{}, nullptr )
    };
}
int main() {
  auto routine = struct_compound_expr();
  routine.handle.destroy();
  return 0;
}
```
Compile and run with -std=c++20 -fsanitize=address. https://godbolt.org/z/1YTW8nbKr

Expected result: Destruct the unique_ptr; print nothing and return 0.

Actual:
```
==1==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x55677ed6b37d in operator new(unsigned long) /root/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
 #1 0x55677ed71294 in std::__detail::_MakeUniq<int>::__single_object std::make_unique<int, int>(int&&) /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/13.0.1/../../../../include/c++/13.0.1/bits/unique_ptr.h:1071:30
 #2 0x55677ed6df05 in struct_compound_expr() /app/example.cpp:16:9
 #3 0x55677ed6e858 in main /app/example.cpp:21:18
    #4 0x7f999389e082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)

SUMMARY: AddressSanitizer: 4 byte(s) leaked in 1 allocation(s).
```

Testcase reduced/modified from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98401#c7>. The issue reproduces with both array list-initialization (as above) and aggregate-initialization of a struct.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVltv6ywW_TXkBcWyIfHlIQ9pU0ujmaOR-p1Po_NkYdhxmBLwAdym_fUjDM2ll_M0kuULhrX32pcFzDk5aIANWt-h9W7BJn8wdrNVnFmz6I143aAyjxdH5C5c-Q7lW0So1FxNAjCi99xYM3mpAdGHr_4f4Wjs6-XnfHfeTtxjJ4-jAoyqhIyx8wLRLaLbM2x3YFooQPT-2UiB6AN-H3hflMBGa47SQedfxxtI_G5mAN9Z8JPVnen_C9wjUiPShLk4jofXP3lwbSIwmuftrTl26c-MuPUH6RBpULVD9A6Hx9mVwCEZ62Y-Zxc-T5t0NCw6OHEYvTT6m-ls8gZLLb1kqnOTG0G_I2sTF1-zPFNMUzsNz2AT6EePZ-y91P9n5DiQauLqPeUq5rTj5jiaSYcIjPaK_CW17wYnLX9P0I3eInovtQ-F8hQrGyO6u111s_LInqCLy89LEanXIYPk_nYRIjU3HXth0n_mytQLe3WJLLnHelJq9BYHoDPKR97zi9QeH5nUnxnO0U91OPP4PjCXhnhfkMX6yQQ4b83r52kxaflnh86NHz_vzXGUCjDTAttJ4xfpD3g5B2CXpIHkeLl3LNTgGyC6Y0JYcC7DB-9HFwJFWkTawYjeKJ8ZOyDSviHSFr9-_qfW_T_ttT48nEbgHkKruEl5RLd4B6nP_QHwdbbv8GhDALXxB6mH6GRill2DbrmfmAqufMUR0R2iuyI-Hh4f__0YrP4L2NNfiZUNAwJ89CzqGlbAnlxE2EkL3M8j2OzxCvevPihC0AIsNS7wWXbmIaaU4SxgBQk5-xXrjOY4P63XZVWBKHtaiYBgRrDMG4s1vCBST3pWcIGV0cNcOKS1xnhEWqWej8vRmmiv5TGBdmnnn7JHpGWO6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