Skip to content

Commit

Permalink
Recognize simple declaration of function name with function type spec…
Browse files Browse the repository at this point in the history
…ifier
  • Loading branch information
i-garrison committed Oct 13, 2023
1 parent 4036cd3 commit 448e886
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13894,4 +13894,22 @@ public void testBuiltinIsConstantEvaluated() throws Exception {
BindingAssertionHelper helper = getAssertionHelper();
helper.assertVariableValue("true_value", 1);
}

// typedef void (function_type_t)(char *, int, double);
//
// void decl_function(char *, int, double) {
// }
//
// extern function_type_t decl_simple;
//
// void decl_simple(char *, int, double) {
// }
//
// function_type_t array[] = {
// decl_function, // reference site marker
// decl_simple, // reference site marker
// };
public void testSimpleDeclarationOfFunction() throws Exception {
parseAndCheckImplicitNameBindings();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4964,7 +4964,7 @@ public static boolean isSameFunction(ICPPFunction function, IASTDeclarator decla
}

declarator = ASTQueries.findTypeRelevantDeclarator(declarator);
if (declarator instanceof ICPPASTFunctionDeclarator) {
if (declarator instanceof ICPPASTFunctionDeclarator || declarator instanceof ICPPASTDeclarator) {
// For declaration matching, compare the declared types (placeholders not resolved).
IType type = function.getDeclaredType();
return type.isSameType(CPPVisitor.createType(declarator, CPPVisitor.DO_NOT_RESOLVE_PLACEHOLDERS));
Expand Down

0 comments on commit 448e886

Please sign in to comment.