Fixed #8851 (Crash in valueFlowContainerForward (daca@home: pbbam))
This commit is contained in:
parent
5eddcb0827
commit
9ef3c79bc6
|
@ -3244,10 +3244,12 @@ void Tokenizer::createLinks2()
|
|||
if (Token::Match(token, "{|[|("))
|
||||
type.push(token);
|
||||
else if (!type.empty() && Token::Match(token, "}|]|)")) {
|
||||
while (type.top()->str() == "<")
|
||||
while (type.top()->str() == "<") {
|
||||
if (templateToken && templateToken->next() == type.top())
|
||||
templateToken = nullptr;
|
||||
type.pop();
|
||||
}
|
||||
type.pop();
|
||||
templateToken = nullptr;
|
||||
} else
|
||||
token->link(nullptr);
|
||||
} else if (!templateToken && !isStruct && Token::Match(token, "%oror%|&&|;")) {
|
||||
|
|
|
@ -4716,6 +4716,16 @@ private:
|
|||
const Token *A = Token::findsimplematch(tokenizer.tokens(), "A <");
|
||||
ASSERT_EQUALS(true, A->next()->link() == A->tokAt(3));
|
||||
}
|
||||
{
|
||||
// #8851
|
||||
const char code[] = "template<typename std::enable_if<!(std::value1) && std::value2>::type>"
|
||||
"void basic_json() {}";
|
||||
errout.str("");
|
||||
Tokenizer tokenizer(&settings0, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
ASSERT_EQUALS(true, Token::simpleMatch(tokenizer.tokens()->next()->link(), "> void"));
|
||||
}
|
||||
}
|
||||
|
||||
void simplifyString() {
|
||||
|
|
Loading…
Reference in New Issue