Skip to content

Commit

Permalink
Fix #9792 (SymbolDatabase: Wrong ValueType is set for function pointe…
Browse files Browse the repository at this point in the history
…r usage 'using fp = int(int*)') (#6715)
  • Loading branch information
danmar authored Aug 21, 2024
1 parent 426c621 commit e3613c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;", "."));
Expand Down

0 comments on commit e3613c4

Please sign in to comment.