File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1342,6 +1342,10 @@ void CheckClass::privateFunctions()
13421342 privateFuncs.pop_front ();
13431343 continue ;
13441344 }
1345+ if (pf->tokenDef && pf->tokenDef ->isAttributeMaybeUnused ()) {
1346+ privateFuncs.pop_front ();
1347+ continue ;
1348+ }
13451349 // Check that all private functions are used
13461350 bool used = checkFunctionUsage (pf, scope); // Usage in this class
13471351 // 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