diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 3272939e6..9a44f6cd7 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -656,7 +656,7 @@ namespace { } } - for (Token* type = start; Token::Match(type, "%name%|*|&"); type = type->next()) { + for (Token* type = start; Token::Match(type, "%name%|*|&|&&"); type = type->next()) { if (type != start && Token::Match(type, "%name% ;") && !type->isStandardType()) { mRangeType.first = start; mRangeType.second = type; @@ -892,7 +892,7 @@ namespace { // Unsplit variable declarations if (tok4 && tok4->isSplittedVarDeclEq() && - ((tok4->isCpp() && Token::Match(tok4->tokAt(-2), "& %name% ;")) || Token::Match(tok4->previous(), "] ; %name% = {"))) { + ((tok4->isCpp() && Token::Match(tok4->tokAt(-2), "&|&& %name% ;")) || Token::Match(tok4->previous(), "] ; %name% = {"))) { tok4->deleteNext(); tok4->deleteThis(); } diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index 1e5570e6f..89a38f394 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -2517,7 +2517,7 @@ private: void simplifyTypedef109() { const char code[] = "typedef int&& rref;\n" "rref var = 0;"; - const char expected[] = "int && var ; var = 0 ;"; + const char expected[] = "int && var = 0 ;"; ASSERT_EQUALS(expected, tok(code)); ASSERT_EQUALS("", errout.str()); }