Fixed #10334 (AST: hang with c++ initializer and emplace_back)
This commit is contained in:
parent
e50f7a3e09
commit
e1cff1d1ef
|
@ -1267,7 +1267,10 @@ static void compileAssignTernary(Token *&tok, AST_state& state)
|
|||
while (tok) {
|
||||
if (tok->isAssignmentOp()) {
|
||||
state.assign++;
|
||||
const Token *tok1 = tok->next();
|
||||
compileBinOp(tok, state, compileAssignTernary);
|
||||
if (Token::simpleMatch(tok1, "{") && tok == tok1->link() && tok->next())
|
||||
tok = tok->next();
|
||||
if (state.assign > 0)
|
||||
state.assign--;
|
||||
} else if (tok->str() == "?") {
|
||||
|
|
|
@ -6047,6 +6047,12 @@ private:
|
|||
ASSERT_EQUALS("decltypex({", testAst("decltype(x){};"));
|
||||
ASSERT_EQUALS("decltypexy+(yx+(", testAst("decltype(x+y)(y+x);"));
|
||||
ASSERT_EQUALS("decltypexy+(yx+{", testAst("decltype(x+y){y+x};"));
|
||||
|
||||
// #10334: Do not hang!
|
||||
tokenizeAndStringify("void foo(const std::vector<std::string>& locations = {\"\"}) {\n"
|
||||
" for (int i = 0; i <= 123; ++i)\n"
|
||||
" x->emplace_back(y);\n"
|
||||
"}");
|
||||
}
|
||||
|
||||
void astbrackets() { // []
|
||||
|
|
Loading…
Reference in New Issue