diff --git a/lib/checkfunctions.cpp b/lib/checkfunctions.cpp index 3d6ff2ce755..f6799d199e7 100644 --- a/lib/checkfunctions.cpp +++ b/lib/checkfunctions.cpp @@ -635,6 +635,12 @@ void CheckFunctions::checkLibraryMatchFunctions() if (!tok->scope() || !tok->scope()->isExecutable()) continue; + // skip uninstantiated templates + if (tok == tok->scope()->bodyStart && tok->scope()->function && tok->scope()->function->templateDef) { + tok = tok->link(); + continue; + } + if (tok->str() == "new") insideNew = true; else if (tok->str() == ";") diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index 48516faf852..feb7f2a666f 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -2220,6 +2220,12 @@ class TestFunctions : public TestFixture { " return b;\n" "}\n", s); TODO_ASSERT_EQUALS("", "[test.cpp:6:5]: (debug) auto token with no type. [autoNoType]\n", errout_str()); + + check("template \n" // #13509 + "void f(const T& t) {\n" + " t.g();\n" + "}\n", s); + ASSERT_EQUALS("", errout_str()); } void checkUseStandardLibrary1() {