Merge branch 'master' of github.com:danmar/cppcheck
This commit is contained in:
commit
d5eaab05bc
|
@ -550,7 +550,7 @@ bool Tokenizer::duplicateTypedef(Token **tokPtr, const Token *name)
|
|||
// look backwards
|
||||
if (Token::Match(tok->previous(), "typedef|}|>|*") ||
|
||||
(Token::Match(tok->previous(), "%type%") &&
|
||||
(!Token::Match(tok->previous(), "return|new|const|friend|public|private|protected") &&
|
||||
(!Token::Match(tok->previous(), "return|new|const|friend|public|private|protected|throw") &&
|
||||
!Token::Match(tok->tokAt(-2), "friend class"))))
|
||||
{
|
||||
// scan backwards for the end of the previous statement
|
||||
|
|
|
@ -204,6 +204,7 @@ private:
|
|||
TEST_CASE(simplifyTypedef51);
|
||||
TEST_CASE(simplifyTypedef52); // ticket #1782
|
||||
TEST_CASE(simplifyTypedef53); // ticket #1801
|
||||
TEST_CASE(simplifyTypedef54); // ticket #1814
|
||||
|
||||
TEST_CASE(simplifyTypedefFunction1);
|
||||
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
||||
|
@ -4206,6 +4207,25 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void simplifyTypedef54() // ticket #1814
|
||||
{
|
||||
const char code[] = "void foo()\n"
|
||||
"{\n"
|
||||
" typedef std::basic_string<char, traits_type, allocator_type> string_type;\n"
|
||||
" try\n"
|
||||
" {\n"
|
||||
" throw string_type(\"leak\");\n"
|
||||
" }\n"
|
||||
" catch (const string_type&)\n"
|
||||
" {\n"
|
||||
" pthread_exit (0);\n"
|
||||
" }\n"
|
||||
"}";
|
||||
|
||||
checkSimplifyTypedef(code);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void simplifyTypedefFunction1()
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue