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

            Bug ID: 95518
           Summary: [coroutines] [[maybe_unused]] does not propagate to
                    actor() and destroy()
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bruck.michael at gmail dot com
  Target Milestone: ---

Example with -Wall -Ofast:
---
#include <coroutine>

struct dummy
{
    struct promise_type
    {
        dummy get_return_object() const noexcept { return {}; }
        std::suspend_never initial_suspend() const noexcept { return {}; }
        std::suspend_never final_suspend() const noexcept { return {}; }
        void return_void() const noexcept {}
        void unhandled_exception() const noexcept {}
    };
    int i; // work around #95516
};

[[maybe_unused]] static dummy foo()
{ 
    co_return;
}

int main() {}
--
<source>:19:1: warning: 'void _ZL3foov.destroy(foo()::_ZL3foov.frame*)' defined
but not used [-Wunused-function]
   19 | }
      | ^
<source>:19:1: warning: 'void _ZL3foov.actor(foo()::_ZL3foov.frame*)' defined
but not used [-Wunused-function]

Reply via email to