File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1338,7 +1338,7 @@ void CheckClass::privateFunctions()
13381338
13391339 while (!privateFuncs.empty ()) {
13401340 const auto & pf = privateFuncs.front ();
1341- if (pf->token ->isAttributeMaybeUnused ()) {
1341+ if (pf->token ->isAttributeMaybeUnused () || pf-> token -> isAttributeUnused () ) {
13421342 privateFuncs.pop_front ();
13431343 continue ;
13441344 }
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ class TestUnusedPrivateFunction : public TestFixture {
8484
8585 TEST_CASE (templateSimplification); // ticket #6183
8686 TEST_CASE (maybeUnused);
87+ TEST_CASE (attributeUnused); // #14129
8788 TEST_CASE (trailingReturn);
8889 }
8990
@@ -884,6 +885,13 @@ class TestUnusedPrivateFunction : public TestFixture {
884885 ASSERT_EQUALS (" " , errout_str ());
885886 }
886887
888+ void attributeUnused () {
889+ check (" class C {\n "
890+ " __attribute__((unused)) int f() { return 42; }\n "
891+ " };" );
892+ ASSERT_EQUALS (" " , errout_str ());
893+ }
894+
887895 void trailingReturn () {
888896 check (" struct B { virtual void f(); };\n "
889897 " struct D : B {\n "
You can’t perform that action at this time.
0 commit comments