Ticket #8654: Properly setup links for variadic template bases. (#1357)

This commit is contained in:
Simon Martin 2018-09-05 14:10:56 +02:00 committed by amai2012
parent 08f301a0de
commit 1d85a78874
2 changed files with 12 additions and 0 deletions

View File

@ -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;
}

View File

@ -4700,6 +4700,17 @@ private:
ASSERT_EQUALS(true, tok1->link() == tok2);
ASSERT_EQUALS(true, tok2->link() == tok1);
}
{
// #8654
const char code[] = "template<int N> struct A {}; "
"template<int... Ns> struct foo : A<Ns>... {};";
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() {