diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 34e0e4227..b21f86b19 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1568,7 +1568,7 @@ private: if (Token::Match(tok2, "%var% (")) break; if (tok2->varId() && - !Token::simpleMatch(tok2->previous(), "&") && + !Token::Match(tok2->previous(), "&|::") && !Token::simpleMatch(tok2->next(), "=")) use(foundError, checks, tok2); } diff --git a/test/testother.cpp b/test/testother.cpp index e4a9fb50f..1d37d7419 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1034,6 +1034,12 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + checkUninitVar("void foo()\n" + "{\n" + " int x = xyz::x;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + checkUninitVar("static int foo()\n" "{\n" " int ret;\n"