diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index a52ceda52..1a897812e 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -1383,6 +1383,7 @@ static void createAstAtTokenInner(Token * const tok1, const Token *endToken, boo if (tok->str() == "(") tok = tok->astOperand1(); const Token * const endToken2 = tok->link(); + tok = tok->next(); for (; tok && tok != endToken && tok != endToken2; tok = tok ? tok->next() : nullptr) tok = createAstAtToken(tok, cpp); } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index fb43920d3..d1d24a2c2 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6011,6 +6011,13 @@ private: // #9729 ASSERT_NO_THROW(tokenizeAndStringify("void foo() { bar([]() noexcept { if (0) {} }); }")); + + // #10079 - createInnerAST bug.. + ASSERT_EQUALS("x{([= yz= switchy(", + testAst("x = []() -> std::vector {\n" + " const auto y = z;\n" + " switch (y) {}\n" + "};")); } void astcase() {