AST: Fixed AST for lambda that returns template type

This commit is contained in:
Daniel Marjamäki 2019-10-30 16:05:34 +01:00
parent 02e7f4f61c
commit 277c59e5f3
2 changed files with 8 additions and 0 deletions

View File

@ -804,6 +804,8 @@ static void compilePrecedence2(Token *&tok, AST_state& state)
if (curlyBracket && curlyBracket->originalName() == "->") {
while (Token::Match(curlyBracket, "%name%|.|::|&|*"))
curlyBracket = curlyBracket->next();
if (curlyBracket && curlyBracket->str() == "<" && curlyBracket->link())
curlyBracket = curlyBracket->link()->next();
}
if (curlyBracket && curlyBracket->str() == "{") {
squareBracket->astOperand1(roundBracket);

View File

@ -7620,6 +7620,12 @@ private:
" a=b;\n"
" }\n"
"}"));
// daca@home hang
ASSERT_EQUALS("a{([= 0return b{([= fori0=i10!=i++;;(",
testAst("a = [&]() -> std::pair<int, int> { return 0; };\n"
"b = [=]() { for (i = 0; i != 10; ++i); };"));
}
void astcase() {