Fixed #3927 (false positive: (error) Uninitialized variable: new)

This commit is contained in:
Daniel Marjamäki 2012-07-08 13:59:00 +02:00
parent f5f63dc4a6
commit bf98e952c1
2 changed files with 5 additions and 1 deletions

View File

@ -4874,7 +4874,7 @@ void Tokenizer::simplifyVarDecl(bool only_k_r_fpar)
if (Token::Match(tok2, "%type% *| %var% , %type% *| %var%"))
continue;
if (Token::Match(tok2, "struct|class %type%")) {
if (Token::Match(tok2, "struct|union|class %type%")) {
tok2 = tok2->next();
++typelen;
}

View File

@ -4726,6 +4726,10 @@ private:
" };\n"
"}";
ASSERT_EQUALS("void f ( ) {\n\nint x ;\nlong & y = x ;\n\n}", tokenizeAndStringify(code2));
// ticket #3927
const char code3[] = "union xy *p = NULL;";
ASSERT_EQUALS("union xy * p ; p = 0 ;", tokenizeAndStringify(code3));
}
void vardecl_par() {