Fix crash in TemplateSimplifier::TokenAndName::TokenAndName in case of template constexpr (#1748)
This is not propper solution. This change just eliminates crash and logs error. https://trac.cppcheck.net/ticket/9046
This commit is contained in:
parent
a135683d2f
commit
7c7ee66cf9
|
@ -83,8 +83,13 @@ TemplateSimplifier::TokenAndName::TokenAndName(Token *tok, const std::string &s,
|
||||||
isAlias(paramEnd->strAt(1) == "using");
|
isAlias(paramEnd->strAt(1) == "using");
|
||||||
isClass(Token::Match(paramEnd->next(), "class|struct|union %name% <|{|:|;"));
|
isClass(Token::Match(paramEnd->next(), "class|struct|union %name% <|{|:|;"));
|
||||||
const Token *tok1 = nameToken->next();
|
const Token *tok1 = nameToken->next();
|
||||||
if (tok1->str() == "<")
|
if (tok1->str() == "<") {
|
||||||
tok1 = tok1->findClosingBracket()->next();
|
const Token *closing = tok1->findClosingBracket();
|
||||||
|
if (closing)
|
||||||
|
tok1 = closing->next();
|
||||||
|
else
|
||||||
|
throw InternalError(tok, "unsupported syntax", InternalError::SYNTAX);
|
||||||
|
}
|
||||||
isFunction(tok1->str() == "(");
|
isFunction(tok1->str() == "(");
|
||||||
isVariable(!isClass() && Token::Match(tok1, "=|;"));
|
isVariable(!isClass() && Token::Match(tok1, "=|;"));
|
||||||
if (isVariable())
|
if (isVariable())
|
||||||
|
|
Loading…
Reference in New Issue