9185: Don't syntax error on nested lambdas (#2672)
This commit is contained in:
parent
91b4d6950b
commit
a45c7752a5
|
@ -9460,7 +9460,7 @@ void Tokenizer::findGarbageCode() const
|
||||||
// Inside [] there can't be ; or various keywords
|
// Inside [] there can't be ; or various keywords
|
||||||
else if (tok->str() == "[") {
|
else if (tok->str() == "[") {
|
||||||
for (const Token* inner = tok->next(); inner != tok->link(); inner = inner->next()) {
|
for (const Token* inner = tok->next(); inner != tok->link(); inner = inner->next()) {
|
||||||
if (Token::Match(inner, "(|["))
|
if (Token::Match(inner, "(|[|{"))
|
||||||
inner = inner->link();
|
inner = inner->link();
|
||||||
else if (Token::Match(inner, ";|goto|return|typedef"))
|
else if (Token::Match(inner, ";|goto|return|typedef"))
|
||||||
syntaxError(inner);
|
syntaxError(inner);
|
||||||
|
|
|
@ -8306,6 +8306,10 @@ private:
|
||||||
"a c{[] {\n"
|
"a c{[] {\n"
|
||||||
" if (0) {}\n"
|
" if (0) {}\n"
|
||||||
"}};\n"));
|
"}};\n"));
|
||||||
|
// #9185
|
||||||
|
ASSERT_NO_THROW(tokenizeAndStringify("void a() {\n"
|
||||||
|
" [b = [] { ; }] {};\n"
|
||||||
|
"}\n"));
|
||||||
}
|
}
|
||||||
void checkIfCppCast() {
|
void checkIfCppCast() {
|
||||||
ASSERT_NO_THROW(tokenizeAndStringify("struct a {\n"
|
ASSERT_NO_THROW(tokenizeAndStringify("struct a {\n"
|
||||||
|
|
Loading…
Reference in New Issue