Simplify rValue reference arguments without name (&& -> & &)

This commit is contained in:
PKEuS 2014-06-04 18:06:22 +02:00
parent 8db0790407
commit 39b64ea5fb
2 changed files with 11 additions and 0 deletions

View File

@ -3493,6 +3493,14 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
elseif();
// Simplify nameless rValue references - named ones are simplified later
for (Token* tok = list.front(); tok; tok = tok->next()) {
if (Token::Match(tok, "&& [,)]")) {
tok->str("&");
tok->insertToken("&");
}
}
validate();
return true;
}

View File

@ -4795,6 +4795,9 @@ private:
tokenizeDebugListing("class C {\n"
" C(int&& a);\n"
"};"));
ASSERT_EQUALS("\n\n##file 0\n"
"1: void foo ( int & & ) ;\n", tokenizeDebugListing("void foo(int&&);"));
}
void varid_arrayFuncPar() {