Merge pull request #158 from simartin/ticket_4764
Ticket #4764: Handle template instantiations with only default parameters
This commit is contained in:
commit
3ac21ab1db
|
@ -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;
|
||||
|
|
|
@ -215,6 +215,7 @@ private:
|
|||
|
||||
TEST_CASE(varid1);
|
||||
TEST_CASE(varid2);
|
||||
TEST_CASE(varid3); // ticket #4764
|
||||
|
||||
TEST_CASE(assign1);
|
||||
|
||||
|
@ -3215,6 +3216,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"
|
||||
|
|
Loading…
Reference in New Issue