Don't assign a varid to a variadic function

This commit is contained in:
PKEuS 2013-03-05 08:32:52 -08:00
parent a94598e447
commit 99a73fe1d3
2 changed files with 7 additions and 1 deletions

View File

@ -2816,7 +2816,7 @@ void Tokenizer::setVarId()
continue;
const Token *tok3 = tok2->next();
if (!tok3->isStandardType() && !Token::Match(tok3,"struct|union|class %type%") && !setVarIdParseDeclaration(&tok3,variableId,executableScope.top())) {
if (!tok3->isStandardType() && !Token::Match(tok3,"struct|union|class %type%") && tok3->str() != "." && !setVarIdParseDeclaration(&tok3,variableId,executableScope.top())) {
variableId[tok2->previous()->str()] = ++_varId;
tok = tok2->previous();
}

View File

@ -268,6 +268,7 @@ private:
TEST_CASE(varid_functionPrototypeTemplate);
TEST_CASE(varid_templatePtr); // #4319
TEST_CASE(varid_templateNamespaceFuncPtr); // #4172
TEST_CASE(varid_variadicFunc);
TEST_CASE(varidclass1);
TEST_CASE(varidclass2);
@ -4264,6 +4265,11 @@ private:
"1: KeyListT < float , & NIFFile :: getFloat > mKeyList@1 [ 4 ] ;\n", tokenizeDebugListing("KeyListT<float, &NIFFile::getFloat> mKeyList[4];"));
}
void varid_variadicFunc() {
ASSERT_EQUALS("\n\n##file 0\n"
"1: int foo ( . . . ) ;\n", tokenizeDebugListing("int foo(...);"));
}
void varidclass1() {
const std::string actual = tokenizeDebugListing(
"class Fred\n"