https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> --- I have a fix. Extended testcase: void fn1([[maybe_unused]] int a) { } void fn2(int a [[maybe_unused]]) { } void fn3(__attribute__((unused)) int a) { } void fn4(int a __attribute__((unused))) { } struct S1 { S1([[maybe_unused]] int a) { } }; struct S2 { S2(int f, [[maybe_unused]] int a) { } }; struct S3 { S3(int a [[maybe_unused]]) { } }; struct S4 { S4(int f, int a [[maybe_unused]]) { } }; struct S5 { S5(__attribute__((unused)) int a) { } }; struct S6 { S6(int f, __attribute__((unused)) int a) { } }; struct S7 { S7(int a __attribute__((unused))) { } }; struct S8 { S8(int f, int a __attribute__((unused))) { } };