Fixed #8788 (AST Broken error from assigning lambda to variable)
This commit is contained in:
parent
39c2625789
commit
15160f1691
|
@ -680,8 +680,10 @@ static void compilePrecedence2(Token *&tok, AST_state& state)
|
||||||
if (Token::simpleMatch(squareBracket->link(), "] (")) {
|
if (Token::simpleMatch(squareBracket->link(), "] (")) {
|
||||||
Token* const roundBracket = squareBracket->link()->next();
|
Token* const roundBracket = squareBracket->link()->next();
|
||||||
Token* curlyBracket = roundBracket->link()->next();
|
Token* curlyBracket = roundBracket->link()->next();
|
||||||
while (Token::Match(curlyBracket, "%name%|.|::|&"))
|
if (curlyBracket && curlyBracket->originalName() == "->") {
|
||||||
|
while (Token::Match(curlyBracket, "%name%|.|::|&|*"))
|
||||||
curlyBracket = curlyBracket->next();
|
curlyBracket = curlyBracket->next();
|
||||||
|
}
|
||||||
if (curlyBracket && curlyBracket->str() == "{") {
|
if (curlyBracket && curlyBracket->str() == "{") {
|
||||||
squareBracket->astOperand1(roundBracket);
|
squareBracket->astOperand1(roundBracket);
|
||||||
roundBracket->astOperand1(curlyBracket);
|
roundBracket->astOperand1(curlyBracket);
|
||||||
|
|
|
@ -8548,7 +8548,8 @@ private:
|
||||||
ASSERT_EQUALS("{([(return 0return", testAst("return []() -> int { return 0; }();"));
|
ASSERT_EQUALS("{([(return 0return", testAst("return []() -> int { return 0; }();"));
|
||||||
ASSERT_EQUALS("{([(return 0return", testAst("return [something]() -> int { return 0; }();"));
|
ASSERT_EQUALS("{([(return 0return", testAst("return [something]() -> int { return 0; }();"));
|
||||||
ASSERT_EQUALS("{([cd,(return 0return", testAst("return [](int a, int b) -> int { return 0; }(c, d);"));
|
ASSERT_EQUALS("{([cd,(return 0return", testAst("return [](int a, int b) -> int { return 0; }(c, d);"));
|
||||||
TODO_ASSERT_EQUALS("x{([=", "stdconst::x{([=&", testAst("x = [&]()->std::string const & { 1; }"));
|
ASSERT_EQUALS("x{([=", testAst("x = [&]()->std::string const & {};"));
|
||||||
|
ASSERT_EQUALS("f{([=", testAst("f = []() -> foo* {};"));
|
||||||
|
|
||||||
ASSERT_EQUALS("x{([= 0return", testAst("x = [](){return 0; };"));
|
ASSERT_EQUALS("x{([= 0return", testAst("x = [](){return 0; };"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue