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

            Bug ID: 122788
           Summary: [[maybe_unused]] ignored in expansion statement
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mkretz at gcc dot gnu.org
  Target Milestone: ---

Test case (https://compiler-explorer.com/z/1nYYPcsn7):

void f()
{
    template for ([[maybe_unused]] auto i : {1})
    {
    }
}

Compile with '-std=c++26 -Wall'.

The warning "unused variable 'i' [-Wunused-variable]" should not be emitted.

Reply via email to