Fixed #3350 (Analysis failed)
This commit is contained in:
parent
c90558f730
commit
50dfdf7c2e
|
@ -2671,11 +2671,16 @@ static void removeTemplates(Token *tok)
|
|||
if (!tok2)
|
||||
break;
|
||||
}
|
||||
if (tok2->str() == ";") {
|
||||
else if (tok2->str() == ";") {
|
||||
Token::eraseTokens(tok, tok2->next());
|
||||
tok->str(";");
|
||||
break;
|
||||
}
|
||||
else if (Token::Match(tok2, ">|>> class %var% [,)]")) {
|
||||
Token::eraseTokens(tok,tok2->next());
|
||||
tok->deleteThis();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,7 @@ private:
|
|||
TEST_CASE(template24); // #2648 - using sizeof in template parameter
|
||||
TEST_CASE(template25); // #2648 - another test for sizeof template parameter
|
||||
TEST_CASE(template26); // #2721 - passing 'char[2]' as template parameter
|
||||
TEST_CASE(template27); // #3350 - removing unused template in macro call
|
||||
TEST_CASE(template_unhandled);
|
||||
TEST_CASE(template_default_parameter);
|
||||
TEST_CASE(template_default_type);
|
||||
|
@ -2095,6 +2096,12 @@ private:
|
|||
ASSERT_EQUALS("; C<2> a ; class C<2> : public A < char [ 2 ] > { }", sizeof_(code));
|
||||
}
|
||||
|
||||
void template27() {
|
||||
// #3350 - template inside macro call
|
||||
const char code[] = "X(template<class T> class Fred);";
|
||||
ASSERT_EQUALS("X ( class Fred ) ;", sizeof_(code));
|
||||
}
|
||||
|
||||
void template_unhandled() {
|
||||
// An unhandled template usage should be simplified..
|
||||
ASSERT_EQUALS("; x<int> ( ) ;", sizeof_(";x<int>();"));
|
||||
|
|
Loading…
Reference in New Issue