diff --git a/lib/library.cpp b/lib/library.cpp index 05d92c047f0..76b549e34f4 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -972,6 +972,8 @@ std::string Library::getFunctionName(const Token *ftok, bool &error) const return ""; } if (ftok->isName()) { + if (Token::simpleMatch(ftok->astParent(), "::")) + return ftok->str(); for (const Scope *scope = ftok->scope(); scope; scope = scope->nestedIn) { if (!scope->isClassOrStruct()) continue; diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index 6fdc2f42dc6..9e677690eda 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -2046,6 +2046,12 @@ class TestFunctions : public TestFixture { " return ::std::string(c);\n" "}\n", "test.cpp", &s); ASSERT_EQUALS("", errout.str()); + + check("template \n" + "struct S : public std::vector {\n" + " void resize(size_t n) { std::vector::resize(n); }\n" + "};\n", "test.cpp", &s); + ASSERT_EQUALS("", errout.str()); } void checkUseStandardLibrary1() {