Fixed #8034 (AST: better handling for c++ type initialization)
This commit is contained in:
parent
5444875f89
commit
dda5556ded
|
@ -386,7 +386,7 @@ static bool iscast(const Token *tok)
|
||||||
// int(1), int*(2), ..
|
// int(1), int*(2), ..
|
||||||
static Token * findCppTypeInitPar(Token *tok)
|
static Token * findCppTypeInitPar(Token *tok)
|
||||||
{
|
{
|
||||||
if (!tok || !Token::Match(tok->previous(), "[,(] %name%"))
|
if (!tok || !Token::Match(tok->previous(), "[,()] %name%"))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
while (Token::Match(tok, "%name%|::|<")) {
|
while (Token::Match(tok, "%name%|::|<")) {
|
||||||
if (tok->str() == "<") {
|
if (tok->str() == "<") {
|
||||||
|
|
|
@ -7933,6 +7933,7 @@ private:
|
||||||
// C++ : type()
|
// C++ : type()
|
||||||
ASSERT_EQUALS("fint(0,(", testAst("f(int(),0);"));
|
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(int *(),0);")); // typedef int* X; f(X(),0);
|
||||||
|
ASSERT_EQUALS("f((0,(", testAst("f((intp)int *(),0);"));
|
||||||
|
|
||||||
// for
|
// for
|
||||||
ASSERT_EQUALS("for;;(", testAst("for(;;)"));
|
ASSERT_EQUALS("for;;(", testAst("for(;;)"));
|
||||||
|
|
Loading…
Reference in New Issue