File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -609,7 +609,7 @@ static bool iscpp11init_impl(const Token * const tok)
609609 if (Token::Match (nameToken, " ]|*" )) {
610610 const Token* tok2 = nameToken;
611611 if (tok2->link ()) {
612- while (tok2 && tok2->link ())
612+ while (tok2 && precedes ( tok2->link (), nameToken ))
613613 tok2 = tok2->link ()->previous ();
614614 }
615615 else
Original file line number Diff line number Diff line change @@ -8712,6 +8712,10 @@ class TestTokenizer : public TestFixture {
87128712 " { 1" ,
87138713 Token::Cpp11init::CPP11INIT);
87148714
8715+ testIsCpp11init (" void f() { g([] { if (int x = 1; x) {} }); }" , // #14790
8716+ " { int" ,
8717+ Token::Cpp11init::NOINIT); // don't hang
8718+
87158719 ASSERT_NO_THROW (tokenizeAndStringify (" template<typename U> struct X {};\n " // don't crash
87168720 " template<typename T> auto f(T t) -> X<decltype(t + 1)> {}\n " ));
87178721 ASSERT_EQUALS (" [test.cpp:2:22]: (debug) auto token with no type. [autoNoType]\n " , errout_str ());
You can’t perform that action at this time.
0 commit comments