parent
0ab7116891
commit
260a757791
|
@ -1720,6 +1720,10 @@ void TokenList::validateAst() const
|
|||
tok = tok->link();
|
||||
continue;
|
||||
}
|
||||
if (tok->isCast() && tok->astOperand1() && tok->link()) { // skip casts (not part of the AST)
|
||||
tok = tok->link();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check binary operators
|
||||
if (Token::Match(tok, "%or%|%oror%|%assign%|%comp%")) {
|
||||
|
|
|
@ -6227,6 +6227,26 @@ private:
|
|||
ASSERT_EQUALS("adecltypeac::(,decltypead::(,",
|
||||
testAst("template <typename a> void b(a &, decltype(a::c), decltype(a::d));"));
|
||||
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("struct A;\n" // #10839
|
||||
"struct B { A* hash; };\n"
|
||||
"auto g(A* a) { return [=](void*) { return a; }; }\n"
|
||||
"void f(void* p, B* b) {\n"
|
||||
" b->hash = (g(b->hash))(p);\n"
|
||||
"}\n"));
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("struct A;\n"
|
||||
"struct B { A* hash; };\n"
|
||||
"A* h(void* p);\n"
|
||||
"typedef A* (*X)(void*);\n"
|
||||
"X g(A*) { return h; }\n"
|
||||
"void f(void* p, B * b) {\n"
|
||||
"b->hash = (g(b->hash))(p);\n"
|
||||
"}\n"));
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("struct A;\n"
|
||||
"struct B { A* hash; };\n"
|
||||
"void f(void* p, B* b) {\n"
|
||||
" b->hash = (decltype(b->hash))(p);\n"
|
||||
"}\n"));
|
||||
|
||||
// #10334: Do not hang!
|
||||
tokenizeAndStringify("void foo(const std::vector<std::string>& locations = {\"\"}) {\n"
|
||||
" for (int i = 0; i <= 123; ++i)\n"
|
||||
|
|
Loading…
Reference in New Issue