Fixed #8034 (AST: better handling for c++ type initialization)

This commit is contained in:
Daniel Marjamäki 2017-05-24 20:24:56 +02:00
parent 5444875f89
commit dda5556ded
2 changed files with 2 additions and 1 deletions

View File

@ -386,7 +386,7 @@ static bool iscast(const Token *tok)
// int(1), int*(2), ..
static Token * findCppTypeInitPar(Token *tok)
{
if (!tok || !Token::Match(tok->previous(), "[,(] %name%"))
if (!tok || !Token::Match(tok->previous(), "[,()] %name%"))
return nullptr;
while (Token::Match(tok, "%name%|::|<")) {
if (tok->str() == "<") {

View File

@ -7933,6 +7933,7 @@ private:
// C++ : type()
ASSERT_EQUALS("fint(0,(", testAst("f(int(),0);"));
ASSERT_EQUALS("f(0,(", testAst("f(int *(),0);")); // typedef int* X; f(X(),0);
ASSERT_EQUALS("f((0,(", testAst("f((intp)int *(),0);"));
// for
ASSERT_EQUALS("for;;(", testAst("for(;;)"));