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

            Bug ID: 125425
           Summary: undiagnosed maybe_unused attribute on static data
                    member
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aoliva at gcc dot gnu.org
  Target Milestone: ---

// { dg-do compile }
// { dg-options "-pedantic" }
struct foo {
  [[maybe_unused]] static int bar; // { dg-warning "" }
};

[dcl.attr.unused]/2 says this attribute can be applied to non-static data
members, leaving static ones out.  IMHO it should thus be diagnosed in strict
compliance mode.

Reply via email to