Merge pull request #158 from simartin/ticket_4764

Ticket #4764: Handle template instantiations with only default parameters
This commit is contained in:
Daniel Marjamäki 2013-08-10 03:22:41 -07:00
commit 3ac21ab1db
2 changed files with 12 additions and 1 deletions

View File

@ -2661,7 +2661,9 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::map<std::stri
} else {
++typeCount;
}
} else if (tok2->str() == "<" && TemplateSimplifier::templateParameters(tok2) > 0) {
} else if ((TemplateSimplifier::templateParameters(tok2) > 0) ||
Token::Match(tok2, "< >") /* Ticket #4764 */)
{
tok2 = tok2->findClosingBracket();
if (!Token::Match(tok2, ">|>>"))
break;

View File

@ -215,6 +215,7 @@ private:
TEST_CASE(varid1);
TEST_CASE(varid2);
TEST_CASE(varid3); // ticket #4764
TEST_CASE(assign1);
@ -3216,6 +3217,14 @@ private:
ASSERT_EQUALS("", errout.str());
}
void varid3() { // #4764
check("struct foo {\n"
" void bar() { return; }\n"
" type<> member[1];\n"
"};");
ASSERT_EQUALS("", errout.str());
}
void assign1() {
check("char str[3] = {'a', 'b', 'c'};\n"
"\n"