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:
parent
d4102ca82f
commit
4970952382
2 changed files with 19 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue