From 10e9f1c483ab1e3bb1d2f36e42c968574670c709 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 23 Jul 2024 18:48:29 +0200 Subject: [PATCH] Update symboldatabase.cpp --- lib/symboldatabase.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 3d8d1c4697c..4082a894e2f 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2497,6 +2497,13 @@ static bool isOperator(const Token *tokenDef) return name.size() > 8 && startsWith(name,"operator") && std::strchr("+-*/%&|~^<>!=[(", name[8]); } +static bool isTrailingReturnType(const Token* tok) +{ + while (tok && tok->isKeyword()) + tok = tok->next(); + return Token::Match(tok, "&|&&| ."); +} + Function::Function(const Token *tok, const Scope *scope, const Token *tokDef, @@ -2540,7 +2547,7 @@ Function::Function(const Token *tok, if (!isConstructor() && !isDestructor()) { // @todo auto type deduction should be checked // @todo attributes and exception specification can also precede trailing return type - if (Token::Match(argDef->link()->next(), "const|volatile| &|&&| .")) { // Trailing return type + if (isTrailingReturnType(argDef->link()->next())) { // Trailing return type hasTrailingReturnType(true); if (argDef->link()->strAt(1) == ".") retDef = argDef->link()->tokAt(2);