File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1346,6 +1346,10 @@ void CheckClass::privateFunctions()
13461346 privateFuncs.pop_front ();
13471347 continue ;
13481348 }
1349+ if (pf->tokenDef && pf->tokenDef ->isAttributeMaybeUnused ()) {
1350+ privateFuncs.pop_front ();
1351+ continue ;
1352+ }
13491353 // Check that all private functions are used
13501354 bool used = checkFunctionUsage (pf, scope); // Usage in this class
13511355 // Check in friend classes
Original file line number Diff line number Diff line change @@ -882,6 +882,12 @@ class TestUnusedPrivateFunction : public TestFixture {
882882 " [[maybe_unused]] int f() { return 42; }\n "
883883 " };" );
884884 ASSERT_EQUALS (" " , errout_str ());
885+
886+ check (" class C {\n "
887+ " [[maybe_unused]] static int f();\n "
888+ " };\n "
889+ " int C::f() { return 42; }\n " );
890+ ASSERT_EQUALS (" " , errout_str ());
885891 }
886892
887893 void trailingReturn () {
You can’t perform that action at this time.
0 commit comments