diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 5e2aa1f90..43731bc97 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3276,6 +3276,7 @@ void Tokenizer::createLinks2() continue; if (token->next() && !Token::Match(token->next(), "%name%|>|&|&&|*|::|,|(|)|{|}|;|[|:") && + !Token::simpleMatch(token->next(), ". . .") && !Token::Match(token->next(), "&& %name% =")) continue; } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index c4476a287..94c01cbc0 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -4700,6 +4700,17 @@ private: ASSERT_EQUALS(true, tok1->link() == tok2); ASSERT_EQUALS(true, tok2->link() == tok1); } + { + // #8654 + const char code[] = "template struct A {}; " + "template struct foo : A... {};"; + errout.str(""); + Tokenizer tokenizer(&settings0, this); + std::istringstream istr(code); + tokenizer.tokenize(istr, "test.cpp"); + const Token *A = Token::findsimplematch(tokenizer.tokens(), "A <"); + ASSERT_EQUALS(true, A->next()->link() == A->tokAt(3)); + } } void simplifyString() {