Skip to content

Commit e3613c4

Browse files
authored
Fix #9792 (SymbolDatabase: Wrong ValueType is set for function pointer usage 'using fp = int(int*)') (danmar#6715)
1 parent 426c621 commit e3613c4

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/symboldatabase.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7166,6 +7166,8 @@ static const Token* parsedecl(const Token* type,
71667166
!type->variable() && !type->function()) {
71677167
bool isIterator = false;
71687168
if (type->str() == "(") {
7169+
if (!Token::simpleMatch(type, "( *"))
7170+
break;
71697171
if (Token::Match(type->link(), ") const| {"))
71707172
break;
71717173
if (par)

test/testsymboldatabase.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9141,6 +9141,7 @@ class TestSymbolDatabase : public TestFixture {
91419141
ASSERT_EQUALS("s", typeOf("struct s { s foo(); s(int, int); }; s s::foo() { return s(1, 2); } ", "( 1 , 2 )"));
91429142
// Some standard template functions.. TODO library configuration
91439143
ASSERT_EQUALS("signed int &&", typeOf("std::move(5);", "( 5 )"));
9144+
ASSERT_EQUALS("signed int", typeOf("using F = int(int*); F* f; f(ptr);", "( ptr")); // #9792
91449145

91459146
// struct member..
91469147
ASSERT_EQUALS("signed int", typeOf("struct AB { int a; int b; } ab; x = ab.a;", "."));

0 commit comments

Comments
 (0)