Fixed #9812 (False positive; syntax error 'using array_p = const array_t *;')
This commit is contained in:
parent
53a0760fdf
commit
3459f0da32
|
@ -1554,7 +1554,7 @@ void Tokenizer::simplifyTypedef()
|
|||
// handle missing variable name
|
||||
if (Token::Match(tok3, "( *|&|&& *|&|&& %name%"))
|
||||
tok2 = tok3->tokAt(3);
|
||||
else if (Token::Match(tok2->tokAt(3), "[(),]"))
|
||||
else if (Token::Match(tok2->tokAt(3), "[(),;]"))
|
||||
tok2 = tok2->tokAt(2);
|
||||
else
|
||||
tok2 = tok2->tokAt(3);
|
||||
|
|
|
@ -168,6 +168,7 @@ private:
|
|||
TEST_CASE(simplifyTypedef130); // ticket #9446
|
||||
TEST_CASE(simplifyTypedef131); // ticket #9446
|
||||
TEST_CASE(simplifyTypedef132); // ticket #9739 - using
|
||||
TEST_CASE(simplifyTypedef133); // ticket #9812 - using
|
||||
|
||||
TEST_CASE(simplifyTypedefFunction1);
|
||||
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
||||
|
@ -2653,6 +2654,13 @@ private:
|
|||
ASSERT_EQUALS(exp, tok(code, false));
|
||||
}
|
||||
|
||||
void simplifyTypedef133() { // #9812
|
||||
const char code[] = "typedef unsigned char array_t[16];\n"
|
||||
"using array_p = const array_t *;\n"
|
||||
"array_p x;\n";
|
||||
ASSERT_EQUALS("using array_p = const unsigned char ( * ) [ 16 ] ; array_p x ;", tok(code, false));
|
||||
}
|
||||
|
||||
void simplifyTypedefFunction1() {
|
||||
{
|
||||
const char code[] = "typedef void (*my_func)();\n"
|
||||
|
|
Loading…
Reference in New Issue