Fixed false positive #6030: inheriting classes is not a variable declaration.
This commit is contained in:
parent
e7605d6f77
commit
fd5ff1bb8b
|
@ -2276,7 +2276,7 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::map<std::stri
|
|||
bool bracket = false;
|
||||
while (tok2) {
|
||||
if (tok2->isName()) {
|
||||
if (cpp && tok2->str() == "namespace")
|
||||
if (cpp && Token::Match(tok2, "namespace|public|private|protected"))
|
||||
return false;
|
||||
if (tok2->str() == "struct" || tok2->str() == "union" || (cpp && (tok2->str() == "class" || tok2->str() == "typename"))) {
|
||||
hasstruct = true;
|
||||
|
|
|
@ -4934,6 +4934,11 @@ private:
|
|||
"std::vector<int> vec{1, 2, 3};\n"
|
||||
"namespace n { int z; };\n"
|
||||
"int& j{i};\n"));
|
||||
|
||||
// #6030
|
||||
ASSERT_EQUALS("\n\n##file 0\n"
|
||||
"1: struct S3 : public S1 , public S2 { } ;\n",
|
||||
tokenizeDebugListing("struct S3 : public S1, public S2 { };"));
|
||||
}
|
||||
|
||||
void varidclass1() {
|
||||
|
|
Loading…
Reference in New Issue