Skip to content

Commit 8170cf5

Browse files
committed
Fix #14344 FP containerOutOfBounds when passing lambda
1 parent a5ec929 commit 8170cf5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/tokenlist.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,6 @@ static bool iscpp11init_impl(const Token * const tok)
573573
if (nameToken->isCpp11init() != Token::Cpp11init::UNKNOWN)
574574
return nameToken->isCpp11init() == Token::Cpp11init::CPP11INIT;
575575
nameToken = nameToken->previous();
576-
if (nameToken && nameToken->str() == "," && Token::simpleMatch(nameToken->previous(), "} ,"))
577-
nameToken = nameToken->linkAt(-1);
578576
}
579577
if (!nameToken)
580578
return false;

test/testtokenize.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8493,6 +8493,10 @@ class TestTokenizer : public TestFixture {
84938493
"{ } } {",
84948494
Token::Cpp11init::CPP11INIT);
84958495

8496+
testIsCpp11init("void f() { g([]() {}, { 1 }); }\n",
8497+
"{ 1",
8498+
Token::Cpp11init::CPP11INIT);
8499+
84968500
ASSERT_NO_THROW(tokenizeAndStringify("template<typename U> struct X {};\n" // don't crash
84978501
"template<typename T> auto f(T t) -> X<decltype(t + 1)> {}\n"));
84988502
ASSERT_EQUALS("[test.cpp:2:22]: (debug) auto token with no type. [autoNoType]\n", errout_str());

0 commit comments

Comments
 (0)