diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 4cee3f838..fa5dccbfa 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -784,7 +784,13 @@ static void compileTerm(Token *&tok, AST_state& state) tok = tok->tokAt(2); } } else if (!state.cpp || !Token::Match(tok, "new|delete %name%|*|&|::|(|[")) { + Token* tok2 = tok; tok = skipDecl(tok); + if (Token::simpleMatch(tok2, "decltype (")) { + Token* tok3 = tok2->next(); + AST_state state1(state.cpp); + compileExpression(tok3, state1); + } bool repeat = true; while (repeat) { repeat = false; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 90638b15f..ec7e4741c 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6885,6 +6885,15 @@ private: ASSERT_NO_THROW(tokenizeAndStringify("void a() {\n" " [b = [] { ; }] {};\n" "}\n")); + + // #10739 + ASSERT_NO_THROW(tokenizeAndStringify("struct a {\n" + " std::vector b;\n" + "};\n" + "void c() {\n" + " a bar;\n" + " (decltype(bar.b)::value_type){};\n" + "}\n")); } void checkIfCppCast() { ASSERT_NO_THROW(tokenizeAndStringify("struct a {\n"