From 04f3caf8e8d1882eb5c1851bdb9de3b7aa0b19b9 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sun, 25 May 2014 12:19:19 +0200 Subject: [PATCH] Fixed debug message #5159 --- lib/symboldatabase.cpp | 2 +- test/testsymboldatabase.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 9196cec63..dd628e6e1 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2578,7 +2578,7 @@ static const Token* skipPointers(const Token* tok) bool Scope::isVariableDeclaration(const Token* tok, const Token*& vartok, const Token*& typetok) const { - if (tok && tok->str() == "throw" && check->_tokenizer->isCPP()) + if (tok && (tok->str() == "throw" || tok->str() == "new") && check->_tokenizer->isCPP()) return false; const Token* localTypeTok = skipScopeIdentifiers(tok); diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 9bafedd16..59120fb72 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -220,6 +220,7 @@ private: TEST_CASE(symboldatabase40); // ticket #5153 TEST_CASE(symboldatabase41); // ticket #5197 (unknown macro) TEST_CASE(symboldatabase42); // only put variables in variable list + TEST_CASE(symboldatabase43); // #4738 TEST_CASE(isImplicitlyVirtual); @@ -1863,6 +1864,13 @@ private: ASSERT_EQUALS(0U, fscope ? fscope->varlist.size() : ~0U); // "x" is not a variable } + void symboldatabase43() { // ticket #4738 + check("void f() {\n" + " new int;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + void isImplicitlyVirtual() { { GET_SYMBOL_DB("class Base {\n"