https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110827

--- Comment #3 from Michael Duggan <mwd at md5i dot com> ---
(In reply to Richard Biener from comment #1)
> I'm seeing all code properly instrumented.  The coverage I see is
> 
>         -:    1:#include <coroutine>
>         -:    2:#include <iostream>
>         -:    3:
>         -:    4:struct task {
>         -:    5:  struct promise {
>         -:    6:    using handle_t = std::coroutine_handle<promise>;
>         1:    7:    task get_return_object() {
>         1:    8:      return task{handle_t::from_promise(*this)};
>         -:    9:    }
>         1:   10:    std::suspend_never initial_suspend() noexcept { return
> {}; }
>         1:   11:    std::suspend_always final_suspend() noexcept { return
> {}; }
>     #####:   12:    void unhandled_exception() { std::terminate(); }
>         1:   13:    void return_void() noexcept {}
>         -:   14:    friend task;
>         -:   15:  };
>         -:   16:  using promise_type = promise;
>         1:   17:  task(promise_type::handle_t handle) : handle_{handle} {}
>         1:   18:  ~task() {
>         1:   19:    if (handle_) {
>         1:   20:      handle_.destroy();
>         -:   21:    }
>         1:   22:  }
>         -:   23: private:
>         -:   24:  promise_type::handle_t handle_;
>         -:   25:};
>         -:   26:
>         1:   27:task foo() {
>         -:   28:  std::cout << "Running..." << std::endl;
>         -:   29:  co_return;
>         2:   30:}
>         -:   31:
>         1:   32:int main(int argc, char **argv) {
>         1:   33:  foo();
>         1:   34:  return 0;
>         -:   35:}
> 
> I have no idea why for example line 28 isn't marked executed.

The point is that no matter what is put in the coroutine, foo, nothing within
the coroutine will ever be marked as having been run.

Reply via email to