Skip to content

Commit

Permalink
decltype
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Jan 12, 2024
1 parent 8f4b44f commit 963fae7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,8 @@ const Token* findLambdaEndTokenWithoutAST(const Token* tok) {
tok = tok->link()->next();
if (Token::simpleMatch(tok, ".")) { // trailing return type
tok = tok->next();
while (Token::Match(tok, "%type%|%name%|::|&|&&|*|<")) {
if (tok->str() == "<")
while (Token::Match(tok, "%type%|%name%|::|&|&&|*|<|(")) {
if (tok->link())
tok = tok->link()->next();
else
tok = tok->next();
Expand Down
9 changes: 9 additions & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2841,6 +2841,15 @@ class TestSymbolDatabase : public TestFixture {
ASSERT_EQUALS(3, db->scopeList.size());
ASSERT_EQUALS(Scope::ScopeType::eLambda, db->scopeList.back().type);
}
{
const char code[] = "void f() {\n"
" auto g = [&](const std::function<int(int)>& h = [](int i) -> decltype(0) { return i; }) {};\n"
"}\n";
GET_SYMBOL_DB(code);
ASSERT(db != nullptr);
ASSERT_EQUALS(3, db->scopeList.size());
ASSERT_EQUALS(Scope::ScopeType::eLambda, db->scopeList.back().type);
}
}

void functionArgs21() {
Expand Down

0 comments on commit 963fae7

Please sign in to comment.