This commit is contained in:
parent
67bfed10a5
commit
eaaff30e65
|
@ -1494,7 +1494,8 @@ void Tokenizer::simplifyTypedef()
|
||||||
tok2 = tok2->next();
|
tok2 = tok2->next();
|
||||||
|
|
||||||
if (openParenthesis) {
|
if (openParenthesis) {
|
||||||
// skip over name
|
// Skip over name, if any
|
||||||
|
if (Token::Match(tok2->next(), "%name%"))
|
||||||
tok2 = tok2->next();
|
tok2 = tok2->next();
|
||||||
|
|
||||||
tok2->insertToken(")");
|
tok2->insertToken(")");
|
||||||
|
|
|
@ -164,6 +164,7 @@ private:
|
||||||
TEST_CASE(simplifyTypedef124); // ticket #7792
|
TEST_CASE(simplifyTypedef124); // ticket #7792
|
||||||
TEST_CASE(simplifyTypedef125); // #8749 - typedef char A[10]; p = new A[1];
|
TEST_CASE(simplifyTypedef125); // #8749 - typedef char A[10]; p = new A[1];
|
||||||
TEST_CASE(simplifyTypedef126); // ticket #5953
|
TEST_CASE(simplifyTypedef126); // ticket #5953
|
||||||
|
TEST_CASE(simplifyTypedef127); // ticket #8878
|
||||||
|
|
||||||
TEST_CASE(simplifyTypedefFunction1);
|
TEST_CASE(simplifyTypedefFunction1);
|
||||||
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
||||||
|
@ -2540,6 +2541,16 @@ private:
|
||||||
ASSERT_EQUALS(exp, tok(code, false));
|
ASSERT_EQUALS(exp, tok(code, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void simplifyTypedef127() { // #8878
|
||||||
|
const char code[] = "class a; typedef int (a::*b); "
|
||||||
|
"template <long, class> struct c; "
|
||||||
|
"template <int g> struct d { enum { e = c<g, b>::f }; };";
|
||||||
|
const char exp [] = "class a ; "
|
||||||
|
"template < long , class > struct c ; "
|
||||||
|
"template < int g > struct d { enum Anonymous0 { e = c < g , int ( a :: * ) > :: f } ; } ;";
|
||||||
|
ASSERT_EQUALS(exp, tok(code, false));
|
||||||
|
}
|
||||||
|
|
||||||
void simplifyTypedefFunction1() {
|
void simplifyTypedefFunction1() {
|
||||||
{
|
{
|
||||||
const char code[] = "typedef void (*my_func)();\n"
|
const char code[] = "typedef void (*my_func)();\n"
|
||||||
|
|
Loading…
Reference in New Issue