1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Bug 413204 - "field could not be resolved" error in function returning

function pointer (really fixed this time)

Change-Id: Ica4255ca554db6952248fe1fae53d188a1b78d75
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/15840
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2013-08-26 02:01:28 -04:00 committed by Sergey Prigogin
parent 4fdb748881
commit 8a58b3aa23
2 changed files with 4 additions and 7 deletions

View file

@ -7459,7 +7459,7 @@ public class AST2Tests extends AST2TestBase {
// a->x; // a->x;
// } // }
public void testFunctionReturningFunctionPointer_413204() throws Exception { public void testFunctionReturningFunctionPointer_413204() throws Exception {
parseAndCheckBindings(getAboveComment(), CPP); parseAndCheckBindings();
} }
// double d = 00.9; // double d = 00.9;

View file

@ -727,12 +727,9 @@ public class CVisitor extends ASTQueries {
boolean isFunction= false; boolean isFunction= false;
if (parent instanceof IASTParameterDeclaration || parent.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER) { if (parent instanceof IASTParameterDeclaration || parent.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER) {
IASTDeclarator fdtor = (IASTDeclarator) parent.getParent(); IASTDeclarator fdtor = (IASTDeclarator) parent.getParent();
if (ASTQueries.findTypeRelevantDeclarator(fdtor) instanceof IASTFunctionDeclarator) { // Create parameter bindings only if the declarator declares a function
IASTDeclarator dtor = fdtor; if (ASTQueries.findTypeRelevantDeclarator(fdtor) == fdtor) {
while (dtor.getNestedDeclarator() != null && !(dtor.getNestedDeclarator() instanceof IASTFunctionDeclarator)) { IASTName n = ASTQueries.findInnermostDeclarator(fdtor).getName();
dtor = dtor.getNestedDeclarator();
}
IASTName n = dtor.getName();
IBinding temp = n.resolveBinding(); IBinding temp = n.resolveBinding();
if (temp != null && temp instanceof CFunction) { if (temp != null && temp instanceof CFunction) {
binding = ((CFunction) temp).resolveParameter(name); binding = ((CFunction) temp).resolveParameter(name);