diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index aaa26e281..342decd7f 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -626,7 +626,8 @@ static bool iscpp11init_impl(const Token * const tok) } if (!nameToken) return false; - if (nameToken->str() == ")" && Token::simpleMatch(nameToken->link()->previous(), "decltype (")) + if (nameToken->str() == ")" && Token::simpleMatch(nameToken->link()->previous(), "decltype (") && + !Token::simpleMatch(nameToken->link()->tokAt(-2), ".")) return true; if (Token::simpleMatch(nameToken, ", {")) return true; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index af9056556..714dda106 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6377,6 +6377,12 @@ private: ASSERT_EQUALS("AB: abc+=", testAst("struct A : public B { void f() { a=b+c; } };")); ASSERT_EQUALS("xfts(=", testAst("; auto x = f(ts...);")); + + // #11369 + ASSERT_NO_THROW(tokenizeAndStringify("int a;\n" + "template auto b() -> decltype(a) {\n" + " if (a) {}\n" + "}\n")); } void astcast() {