Fix #9383 ("debug: Function::addArguments found argument 'x' with varid 0." with variadic templates) (#2238)

This commit is contained in:
IOBYTE 2019-10-06 06:45:42 -04:00 committed by Daniel Marjamäki
parent 3c085fd88a
commit 78b9fd9bb9
2 changed files with 14 additions and 1 deletions

View File

@ -3002,7 +3002,7 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::map<std::stri
bracket = true; // Skip: Seems to be valid pointer to array or function pointer bracket = true; // Skip: Seems to be valid pointer to array or function pointer
} else if (tok2->str() == "::") { } else if (tok2->str() == "::") {
singleNameCount = 0; singleNameCount = 0;
} else if (tok2->str() != "*" && tok2->str() != "::") { } else if (tok2->str() != "*" && tok2->str() != "::" && tok2->str() != "...") {
break; break;
} }
tok2 = tok2->next(); tok2 = tok2->next();

View File

@ -164,6 +164,7 @@ private:
TEST_CASE(varid_lambda_mutable); TEST_CASE(varid_lambda_mutable);
TEST_CASE(varid_trailing_return1); // #8889 TEST_CASE(varid_trailing_return1); // #8889
TEST_CASE(varid_trailing_return2); // #9066 TEST_CASE(varid_trailing_return2); // #9066
TEST_CASE(varid_parameter_pack); // #9383
TEST_CASE(varidclass1); TEST_CASE(varidclass1);
TEST_CASE(varidclass2); TEST_CASE(varidclass2);
@ -2535,6 +2536,18 @@ private:
ASSERT_EQUALS(exp1, tokenize(code1)); ASSERT_EQUALS(exp1, tokenize(code1));
} }
void varid_parameter_pack() { // #9383
const char code1[] = "template <typename... Rest>\n"
"void func(Rest... parameters) {\n"
" foo(parameters...);\n"
"}\n";
const char exp1[] = "1: template < typename ... Rest >\n"
"2: void func ( Rest ... parameters@1 ) {\n"
"3: foo ( parameters@1 ... ) ;\n"
"4: }\n";
ASSERT_EQUALS(exp1, tokenize(code1));
}
void varidclass1() { void varidclass1() {
const std::string actual = tokenize( const std::string actual = tokenize(
"class Fred\n" "class Fred\n"