Fix 10139: AST broken; std::enable_if_t<> (#3424)
This commit is contained in:
parent
4566e0e439
commit
c0765c451d
|
@ -2900,12 +2900,11 @@ void Tokenizer::combineOperators()
|
|||
// combine +-*/ and =
|
||||
if (c2 == '=' && (std::strchr("+-*/%|^=!<>", c1))) {
|
||||
// skip templates
|
||||
if (cpp && tok->str() == ">") {
|
||||
const Token *opening = tok->findOpeningBracket();
|
||||
if (opening) {
|
||||
if (Token::Match(opening->previous(), "%name%"))
|
||||
continue;
|
||||
}
|
||||
if (cpp && (tok->str() == ">" || Token::simpleMatch(tok->previous(), "> *"))) {
|
||||
const Token* opening =
|
||||
tok->str() == ">" ? tok->findOpeningBracket() : tok->previous()->findOpeningBracket();
|
||||
if (opening && Token::Match(opening->previous(), "%name%"))
|
||||
continue;
|
||||
}
|
||||
tok->str(tok->str() + c2);
|
||||
tok->deleteNext();
|
||||
|
@ -4561,7 +4560,7 @@ void Tokenizer::createLinks2()
|
|||
if (!top2 || top2->str() != "<") {
|
||||
if (token->str() == ">>")
|
||||
continue;
|
||||
if (!Token::Match(token->next(), "%name%|%cop%|::|,|(|)|{|}|;|[|:|.|=|...") &&
|
||||
if (!Token::Match(token->next(), "%name%|%cop%|%assign%|::|,|(|)|{|}|;|[|:|.|=|...") &&
|
||||
!Token::Match(token->next(), "&& %name% ="))
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -6479,6 +6479,9 @@ private:
|
|||
" int x = a < b ? b : a;"
|
||||
"};\n"));
|
||||
|
||||
// #10139
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("template<typename F>\n"
|
||||
"void foo(std::enable_if_t<value<F>>* = 0) {}\n"));
|
||||
}
|
||||
|
||||
void checkTemplates() {
|
||||
|
|
Loading…
Reference in New Issue