diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 04eb4fae2..d55d75c55 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -897,7 +897,8 @@ static void compilePrecedence2(Token *&tok, AST_state& state) if (tok->tokType() == Token::eIncDecOp && !isPrefixUnary(tok, state.cpp)) { compileUnaryOp(tok, state, compileScope); } else if (tok->str() == "...") { - state.op.push(tok); + if (!Token::simpleMatch(tok->previous(), ")")) + state.op.push(tok); tok = tok->next(); break; } else if (tok->str() == "." && tok->strAt(1) != "*") { diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index db83f947e..a6f5025ad 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6465,6 +6465,24 @@ private: ASSERT_EQUALS("xfts(=", testAst("; auto x = f(ts...);")); + ASSERT_EQUALS("da((new= ifd(", testAst("template \n" // #10199 + "void c(b... e) {\n" + " a d = new a((e)...);\n" + " if (d) {}\n" + "}\n")); + + ASSERT_EQUALS("ad*astdforward::e((new= ifd(", testAst("struct a {};\n" // #11103 + "template void c(b... e) {\n" + " a* d = new a(std::forward(e)...);\n" + " if (d) {}\n" + "}\n")); + + ASSERT_EQUALS("stddir::Args...&&, dir\"abc\"+= dirconcatstdforward::args((+return", + testAst("template std::string concat(std::string dir, Args&& ...args) {\n" // #10492 + " dir += \"abc\";\n" + " return dir + concat(std::forward(args)...);\n" + "}\n")); + // #11369 ASSERT_NO_THROW(tokenizeAndStringify("int a;\n" "template auto b() -> decltype(a) {\n"