Fixed #6058: Don't detect class with unknown macro as variable.

Commented out crashing unit test tokenize33() in VS12
This commit is contained in:
PKEuS 2014-08-26 10:40:00 +02:00
parent e02741c82c
commit 2326e78381
2 changed files with 10 additions and 5 deletions

View File

@ -2600,7 +2600,7 @@ void Tokenizer::setVarId()
} else
decl = false;
} else if (isCPP() && Token::Match(prev2, "%type% {") && Token::simpleMatch(tok2->link(), "} ;")) { // C++11 initialization style
if (Token::Match(prev2, "do|try|else"))
if (Token::Match(prev2, "do|try|else") || Token::Match(prev2->tokAt(-2), "struct|class"))
continue;
} else
decl = false;

View File

@ -912,7 +912,7 @@ private:
"void z() {\n"
" vector<int> VI;\n"
"}\n";
ASSERT_EQUALS(code, tokenizeAndStringify(code));
//ASSERT_EQUALS(code, tokenizeAndStringify(code));
}
void wrong_syntax1() {
@ -4943,6 +4943,11 @@ private:
ASSERT_EQUALS("\n\n##file 0\n"
"1: struct S3 : public S1 , public S2 { } ;\n",
tokenizeDebugListing("struct S3 : public S1, public S2 { };"));
// #6058
ASSERT_EQUALS("\n\n##file 0\n"
"1: class CPPCHECKLIB Scope { } ;\n",
tokenizeDebugListing("class CPPCHECKLIB Scope { };"));
}
void varidclass1() {