Fix varid0 with rvalue reference typedef (#5649)

This commit is contained in:
chrchr-github 2023-11-11 10:09:08 +01:00 committed by GitHub
parent 328daeceb4
commit 2d232dcaac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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();
}

View File

@ -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());
}