From 1032eb24491925646028b5770e7f33f796060707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 3 Jan 2010 08:03:28 +0100 Subject: [PATCH] Fixed #1214 (false positive: uninitialized variable 'bool fixed = std::ios_base::fixed;') --- lib/checkother.cpp | 2 +- test/testother.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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"