Fix 10615: Crash in Token::linkAt (#3599)
This commit is contained in:
parent
bc31419da0
commit
29dbded4af
|
@ -4462,8 +4462,7 @@ void Tokenizer::createLinks2()
|
||||||
type.pop();
|
type.pop();
|
||||||
}
|
}
|
||||||
type.pop();
|
type.pop();
|
||||||
} else
|
}
|
||||||
token->link(nullptr);
|
|
||||||
} else if (templateTokens.empty() && !isStruct && Token::Match(token, "%oror%|&&|;")) {
|
} else if (templateTokens.empty() && !isStruct && Token::Match(token, "%oror%|&&|;")) {
|
||||||
if (Token::Match(token, "&& [,>]"))
|
if (Token::Match(token, "&& [,>]"))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -3335,6 +3335,19 @@ private:
|
||||||
ASSERT_EQUALS(true, tok1->link() == tok2);
|
ASSERT_EQUALS(true, tok1->link() == tok2);
|
||||||
ASSERT_EQUALS(true, tok2->link() == tok1);
|
ASSERT_EQUALS(true, tok2->link() == tok1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// #10615
|
||||||
|
const char code[] = "struct A : public B<__is_constructible()>{};\n";
|
||||||
|
errout.str("");
|
||||||
|
Tokenizer tokenizer(&settings0, this);
|
||||||
|
std::istringstream istr(code);
|
||||||
|
ASSERT(tokenizer.tokenize(istr, "test.cpp"));
|
||||||
|
const Token* tok1 = Token::findsimplematch(tokenizer.tokens(), "< >");
|
||||||
|
const Token* tok2 = Token::findsimplematch(tok1, "> { } >");
|
||||||
|
ASSERT_EQUALS(true, tok1->link() == tok2);
|
||||||
|
ASSERT_EQUALS(true, tok2->link() == tok1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyString() {
|
void simplifyString() {
|
||||||
|
|
Loading…
Reference in New Issue