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

Yaoxin Liu <liuyaoxin1976 at qq dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |liuyaoxin1976 at qq dot com

--- Comment #1 from Yaoxin Liu <liuyaoxin1976 at qq dot com> ---
#include <coroutine>
#include <string>
#include <vector>

using namespace std::literals;

struct task {
  struct promise_type {
    auto initial_suspend() noexcept { return std::suspend_always{}; }
    auto final_suspend() noexcept { return std::suspend_always{}; }
    void return_void() {}
    task get_return_object() { return task{}; }
    void unhandled_exception() noexcept {}
  };

  bool await_ready() const noexcept { return false; }
  void await_suspend(std::coroutine_handle<>) noexcept {}
  void await_resume() noexcept {}
};

task f(std::vector<int>) { co_return; }

task f(std::vector<std::string>) { co_return; }

task g() {
  co_await f(std::vector<int>{1, 2, 3});  // ok
  co_await f(std::vector<std::string>{}); // ok

  auto s1 = "hello1"s;
  auto s2 = "hello2"s;
  auto s3 = "hello3"s;
  co_await f(std::vector<std::string>{s1, s2, s3}); // error
}

See https://godbolt.org/z/z9x8Y96j6

Reply via email to