diff --git a/lib/checkfunctions.cpp b/lib/checkfunctions.cpp index 37ebca53e2d..a521f14b4fb 100644 --- a/lib/checkfunctions.cpp +++ b/lib/checkfunctions.cpp @@ -637,6 +637,9 @@ void CheckFunctions::checkLibraryMatchFunctions() if (mSettings->library.podtype(tok->expressionString())) continue; + if (mSettings->library.getTypeCheck("unusedvar", functionName) != Library::TypeCheck::def) + continue; + const Token* start = tok; while (Token::Match(start->tokAt(-2), "%name% ::")) start = start->tokAt(-2); diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index 63be8faa4d9..9a447891e35 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -1959,6 +1959,11 @@ class TestFunctions : public TestFixture { "[test.cpp:5]: (information) --check-library: There is no matching configuration for function F::g()\n", errout.str()); + check("auto f() {\n" + " return std::runtime_error(\"abc\");\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + settings = settings_old; }