public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gleb at scylladb dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95813] New: Making static member function a coroutine may cause "defined but not used" warning for destroy(frame*) function Date: Mon, 22 Jun 2020 09:14:18 +0000 [thread overview] Message-ID: <bug-95813-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95813 Bug ID: 95813 Summary: Making static member function a coroutine may cause "defined but not used" warning for destroy(frame*) function Product: gcc Version: 10.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gleb at scylladb dot com Target Milestone: --- Compiling the code below with -Wall emits: warn.cc:37:5: warning: ^Xגvoid xxx::_ZN3xxx4funcEv.destroy(xxx::func()::_ZN3xxx4funcEv.frame*)^Yג defined but not used [-Wunused-function] and if foo() is uncommented the code compiles fine. If should be OK to have the static member function in a header without getting the warning. #include <coroutine> #include <functional> #include <optional> #include <cassert> template <typename T> class lazy { T _v = 0; public: lazy() {} bool await_ready() {return true;} void await_suspend(auto x) noexcept {} T await_resume() { return _v; } }; namespace std { template <typename T, typename... Args> struct coroutine_traits<lazy<T>, Args...> { struct promise_type { suspend_always initial_suspend() const { return {}; } suspend_always final_suspend() const { return {}; } void return_value(T val) {} lazy<T> get_return_object() { return lazy<T>(); } void unhandled_exception() { std::terminate(); } }; }; } struct xxx { static lazy<int> func() { co_return 1; } }; #if 0 lazy<int> foo() { co_return co_await xxx::func(); } #endif
next reply other threads:[~2020-06-22 9:14 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-22 9:14 gleb at scylladb dot com [this message] 2020-06-23 9:09 ` [Bug c++/95813] " iains at gcc dot gnu.org 2020-06-24 20:06 ` cvs-commit at gcc dot gnu.org 2020-06-28 8:59 ` cvs-commit at gcc dot gnu.org 2020-06-28 9:06 ` iains at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-95813-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).