Fix ticket #239 (missing function implementation in namespace causes crash)
http://apps.sourceforge.net/trac/cppcheck/ticket/239
This commit is contained in:
parent
263c5b9e5a
commit
14bdf1ee62
|
@ -725,7 +725,7 @@ void Tokenizer::simplifyNamespaces()
|
|||
{
|
||||
for (Token *token = _tokens; token; token = token->next())
|
||||
{
|
||||
while (token->str() == "namespace" &&
|
||||
while (token && token->str() == "namespace" &&
|
||||
(!token->previous() || token->previous()->str() != "using"))
|
||||
{
|
||||
// Token is namespace and there is no "using" before it.
|
||||
|
@ -759,6 +759,9 @@ void Tokenizer::simplifyNamespaces()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!token)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -557,6 +557,14 @@ private:
|
|||
|
||||
ASSERT_EQUALS(expected, sizeof_(code));
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "int a; namespace b{ }";
|
||||
|
||||
const std::string expected(" int a ;");
|
||||
|
||||
ASSERT_EQUALS(expected, sizeof_(code));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue