Fixed ticket #3448 (segmentation fault of cppcheck).
Add testcase related to previous commit (add 'A f(&x);' as declaration of variable).
This commit is contained in:
parent
b9c796d9f8
commit
38e0e25ce0
|
@ -2518,7 +2518,8 @@ void Tokenizer::simplifyDefaultAndDeleteInsideClass()
|
|||
tok2 = tok2->previous();
|
||||
if (Token::Match(tok2, "[;{}]") || tok2->isName())
|
||||
Token::eraseTokens(tok2, end);
|
||||
tok2 = end;
|
||||
else
|
||||
tok2 = end->previous();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3054,12 +3054,22 @@ private:
|
|||
}
|
||||
|
||||
void varid37() {
|
||||
const std::string code = "void blah() {"
|
||||
" Bar bar(*x);"
|
||||
"}";
|
||||
ASSERT_EQUALS("\n\n##file 0\n1: "
|
||||
"void blah ( ) { Bar bar@1 ( * x ) ; }\n",
|
||||
tokenizeDebugListing(code));
|
||||
{
|
||||
const std::string code = "void blah() {"
|
||||
" Bar bar(*x);"
|
||||
"}";
|
||||
ASSERT_EQUALS("\n\n##file 0\n1: "
|
||||
"void blah ( ) { Bar bar@1 ( * x ) ; }\n",
|
||||
tokenizeDebugListing(code));
|
||||
}
|
||||
{
|
||||
const std::string code = "void blah() {"
|
||||
" Bar bar(&x);"
|
||||
"}";
|
||||
ASSERT_EQUALS("\n\n##file 0\n1: "
|
||||
"void blah ( ) { Bar bar@1 ( & x ) ; }\n",
|
||||
tokenizeDebugListing(code));
|
||||
}
|
||||
}
|
||||
|
||||
void varid38() {
|
||||
|
@ -5171,6 +5181,15 @@ private:
|
|||
TODO_ASSERT_EQUALS("struct foo { }",
|
||||
"struct foo { foo ( ) ; } foo :: foo ( ) = delete ;", tokenizeAndStringify(code));
|
||||
}
|
||||
|
||||
//ticket #3448 (segmentation fault)
|
||||
{
|
||||
const char *code = "struct A {"
|
||||
" void bar () = delete;"
|
||||
"};"
|
||||
"void baz () = delete;";
|
||||
ASSERT_EQUALS("struct A { } ; void baz ( ) = delete ;", tokenizeAndStringify(code));
|
||||
}
|
||||
}
|
||||
|
||||
std::string arraySize_(const std::string &code) {
|
||||
|
|
Loading…
Reference in New Issue