1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

Recognize simple declaration of function name with function type specifier (#595)

This commit is contained in:
Igor V. Kovalenko 2023-12-29 00:29:40 +03:00 committed by GitHub
parent d4102ca82f
commit 4970952382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -13894,4 +13894,22 @@ public class AST2CPPTests extends AST2CPPTestBase {
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();
}
}

View file

@ -4964,7 +4964,7 @@ public class CPPSemantics {
}
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));