Fixed #2000 (segmentation fault of cppcheck with bitfield)
This commit is contained in:
parent
16efc9be26
commit
c56911ba6a
|
@ -348,8 +348,10 @@ void CheckClass::createSymbolDatabase()
|
|||
|
||||
// skip over function body
|
||||
tok = next->next();
|
||||
while (tok->str() != "{")
|
||||
while (tok && tok->str() != "{")
|
||||
tok = tok->next();
|
||||
if (!tok)
|
||||
return;
|
||||
tok = tok->link();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,6 +154,7 @@ private:
|
|||
|
||||
TEST_CASE(symboldatabase1);
|
||||
TEST_CASE(symboldatabase2);
|
||||
TEST_CASE(symboldatabase3); // ticket #2000
|
||||
}
|
||||
|
||||
// Check the operator Equal
|
||||
|
@ -4278,6 +4279,15 @@ private:
|
|||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void symboldatabase3()
|
||||
{
|
||||
checkConst("typedef void (func_type)();\n"
|
||||
"struct A {\n"
|
||||
" friend func_type f : 2;\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestClass)
|
||||
|
|
Loading…
Reference in New Issue