diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 1e43a67c8..cb3dc83f9 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3002,7 +3002,7 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::mapstr() == "::") { singleNameCount = 0; - } else if (tok2->str() != "*" && tok2->str() != "::") { + } else if (tok2->str() != "*" && tok2->str() != "::" && tok2->str() != "...") { break; } tok2 = tok2->next(); diff --git a/test/testvarid.cpp b/test/testvarid.cpp index 1ee2b4868..91910b30b 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -164,6 +164,7 @@ private: TEST_CASE(varid_lambda_mutable); TEST_CASE(varid_trailing_return1); // #8889 TEST_CASE(varid_trailing_return2); // #9066 + TEST_CASE(varid_parameter_pack); // #9383 TEST_CASE(varidclass1); TEST_CASE(varidclass2); @@ -2535,6 +2536,18 @@ private: ASSERT_EQUALS(exp1, tokenize(code1)); } + void varid_parameter_pack() { // #9383 + const char code1[] = "template \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() { const std::string actual = tokenize( "class Fred\n"