Support rValue references in typedef (#1823)
This commit is contained in:
parent
efab840b50
commit
35b00a5e05
|
@ -687,7 +687,7 @@ void Tokenizer::simplifyTypedef()
|
|||
}
|
||||
|
||||
// check for pointers and references
|
||||
while (Token::Match(tokOffset, "*|&|const")) {
|
||||
while (Token::Match(tokOffset, "*|&|&&|const")) {
|
||||
pointers.push_back(tokOffset->str());
|
||||
tokOffset = tokOffset->next();
|
||||
}
|
||||
|
|
|
@ -304,6 +304,7 @@ private:
|
|||
TEST_CASE(simplifyTypedef106); // ticket #3619
|
||||
TEST_CASE(simplifyTypedef107); // ticket #3963 - bad code => segmentation fault
|
||||
TEST_CASE(simplifyTypedef108); // ticket #4777
|
||||
TEST_CASE(simplifyTypedef109); // ticket #1823 - rvalue reference
|
||||
|
||||
TEST_CASE(simplifyTypedefFunction1);
|
||||
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
||||
|
@ -5725,6 +5726,16 @@ private:
|
|||
ASSERT_EQUALS(expected, tok(code));
|
||||
}
|
||||
|
||||
void simplifyTypedef109() {
|
||||
const char code[] = "typedef int&& rref;\n"
|
||||
"rref var;";
|
||||
const char expected[] = "int & & var ;";
|
||||
|
||||
checkSimplifyTypedef(code);
|
||||
ASSERT_EQUALS(expected, tok(code));
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void simplifyTypedefFunction1() {
|
||||
{
|
||||
const char code[] = "typedef void (*my_func)();\n"
|
||||
|
|
Loading…
Reference in New Issue