Fixed #1615 (False positive - C-style pointer casting)
This commit is contained in:
parent
7d391b37c9
commit
f4ce5a37d7
|
@ -1030,7 +1030,7 @@ void Tokenizer::simplifyTypedef()
|
||||||
{
|
{
|
||||||
if (tok2->next()->str() == "(")
|
if (tok2->next()->str() == "(")
|
||||||
tok2 = tok2->next()->link();
|
tok2 = tok2->next()->link();
|
||||||
else if (tok2->next()->str() != "[")
|
else if (!Token::Match(tok2->next(), "[|>"))
|
||||||
{
|
{
|
||||||
tok2 = tok2->next();
|
tok2 = tok2->next();
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,7 @@ private:
|
||||||
TEST_CASE(simplifyTypedef43); // ticket #1588
|
TEST_CASE(simplifyTypedef43); // ticket #1588
|
||||||
TEST_CASE(simplifyTypedef44);
|
TEST_CASE(simplifyTypedef44);
|
||||||
TEST_CASE(simplifyTypedef45); // ticket #1613
|
TEST_CASE(simplifyTypedef45); // ticket #1613
|
||||||
|
TEST_CASE(simplifyTypedef46); // ticket #1615
|
||||||
|
|
||||||
TEST_CASE(reverseArraySyntax)
|
TEST_CASE(reverseArraySyntax)
|
||||||
TEST_CASE(simplify_numeric_condition)
|
TEST_CASE(simplify_numeric_condition)
|
||||||
|
@ -3893,6 +3894,21 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void simplifyTypedef46()
|
||||||
|
{
|
||||||
|
// ticket # 1615
|
||||||
|
const char code[] = "typedef void (*my_func)(arg_class*);\n"
|
||||||
|
"std::queue<my_func> func_queue;";
|
||||||
|
|
||||||
|
// The expected result..
|
||||||
|
const std::string expected("; "
|
||||||
|
"std :: queue < void ( * ) ( arg_class * ) > func_queue ;");
|
||||||
|
ASSERT_EQUALS(expected, sizeof_(code));
|
||||||
|
|
||||||
|
checkSimplifyTypedef(code);
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void reverseArraySyntax()
|
void reverseArraySyntax()
|
||||||
{
|
{
|
||||||
ASSERT_EQUALS("a [ 13 ]", tok("13[a]"));
|
ASSERT_EQUALS("a [ 13 ]", tok("13[a]"));
|
||||||
|
|
Loading…
Reference in New Issue