From f32f8775df3d102a093b821081775f785d19414e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 21 Aug 2024 16:48:23 +0200 Subject: [PATCH] Fix #9792 (Wrong ValueType for function pointer) --- lib/symboldatabase.cpp | 2 ++ test/testsymboldatabase.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 7573bb2c42b..7b8e9b6f947 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -7166,6 +7166,8 @@ static const Token* parsedecl(const Token* type, !type->variable() && !type->function()) { bool isIterator = false; if (type->str() == "(") { + if (!Token::simpleMatch(type, "( *")) + break; if (Token::Match(type->link(), ") const| {")) break; if (par) diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 70bca8111db..f3389e9a711 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -9141,6 +9141,7 @@ class TestSymbolDatabase : public TestFixture { ASSERT_EQUALS("s", typeOf("struct s { s foo(); s(int, int); }; s s::foo() { return s(1, 2); } ", "( 1 , 2 )")); // Some standard template functions.. TODO library configuration ASSERT_EQUALS("signed int &&", typeOf("std::move(5);", "( 5 )")); + ASSERT_EQUALS("signed int", typeOf("using F = int(int*); F* f; f(ptr);", "( ptr")); // #9792 // struct member.. ASSERT_EQUALS("signed int", typeOf("struct AB { int a; int b; } ab; x = ab.a;", "."));