From 97326fce1391de1babd7480b8b535d5b92d33e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 12 Oct 2015 10:15:02 +0200 Subject: [PATCH] Fixed #6992 (argument name of function typedef conflicts with local variable name) --- lib/tokenize.cpp | 4 +++- test/testsimplifytypedef.cpp | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 33454f05a..8616d3b26 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5189,9 +5189,11 @@ void Tokenizer::simplifyFunctionPointers() continue; while (Token::Match(tok2, "(|:: %type%")) tok2 = tok2->tokAt(2); - if (!Token::Match(tok2, "(|:: * %name%")) + if (!Token::Match(tok2, "(|:: * *| %name%")) continue; tok2 = tok2->tokAt(2); + if (tok2->str() == "*") + tok2 = tok2->next(); while (Token::Match(tok2, "%type%|:: %type%|::")) tok2 = tok2->next(); diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index 0b89d4305..7d3c18653 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -1000,7 +1000,7 @@ private: "class X { } ; " "int main ( ) " "{ " - "X ( * * Foo ) ( const X & ) ; Foo = new X ( * ) ( const X & ) [ 2 ] ; " + "X * * Foo ; Foo = new X ( * ) ( const X & ) [ 2 ] ; " "}"; ASSERT_EQUALS(expected, tok(code, false)); @@ -2990,8 +2990,8 @@ private: "{ " "int Format_T2 ; " "} " - "int ( * * t1 ) ( ) ; " - "int ( * * t2 ) ( ) ;", + "int * * t1 ; " + "int * * t2 ;", tok(code,false)); }