diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index f5cb0281a..8a81231e8 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -814,7 +814,7 @@ static void compileTerm(Token *&tok, AST_state& state) state.op.push(tok); if (Token::Match(tok, "%name% <") && tok->linkAt(1)) tok = tok->linkAt(1); - else if (Token::Match(tok, "%name% ...") || (state.op.size() == 1 && Token::Match(tok->previous(), "( %name% ) ="))) + else if (Token::Match(tok, "%name% ...") || (state.op.size() == 1 && Token::Match(tok->tokAt(-2), ") ( %name% ) ="))) tok = tok->next(); tok = tok->next(); if (Token::Match(tok, "%str%")) { diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 5bfdbaf56..7aeaa5412 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6219,6 +6219,7 @@ private: " for (decltype(t->p) (c) = t->p; ;) {}\n" "}\n")); ASSERT_EQUALS("x0=a, stdtie::a(x=", testAst("int x = 0, a; std::tie(a) = x;\n")); + ASSERT_EQUALS("tmpa*=a*b*=,b*tmp=,", testAst("{ ((tmp) = (*a)), ((*a) = (*b)), ((*b) = (tmp)); }")); } void astunaryop() { // unary operators