diff options
author | Nathan Ridge | 2013-08-26 06:01:28 +0000 |
---|---|---|
committer | Sergey Prigogin | 2013-08-27 02:38:20 +0000 |
commit | 9745cb982655172e4a354dd967e80dee06ad3bc5 (patch) | |
tree | 7f3bfdbefef42ffb6c6f307798ff0f95577e9434 /core | |
parent | c68190a67c294597289762543edb8bcd91c2e8a7 (diff) | |
download | org.eclipse.cdt-9745cb982655172e4a354dd967e80dee06ad3bc5.tar.gz org.eclipse.cdt-9745cb982655172e4a354dd967e80dee06ad3bc5.tar.xz org.eclipse.cdt-9745cb982655172e4a354dd967e80dee06ad3bc5.zip |
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>
Diffstat (limited to 'core')
2 files changed, 4 insertions, 7 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index 816f687659d..f4358768c91 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -7459,7 +7459,7 @@ public class AST2Tests extends AST2TestBase { // a->x; // } public void testFunctionReturningFunctionPointer_413204() throws Exception { - parseAndCheckBindings(getAboveComment(), CPP); + parseAndCheckBindings(); } // double d = 00.9; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java index f0a49f4fce3..16b1839d170 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java @@ -727,12 +727,9 @@ public class CVisitor extends ASTQueries { boolean isFunction= false; if (parent instanceof IASTParameterDeclaration || parent.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER) { IASTDeclarator fdtor = (IASTDeclarator) parent.getParent(); - if (ASTQueries.findTypeRelevantDeclarator(fdtor) instanceof IASTFunctionDeclarator) { - IASTDeclarator dtor = fdtor; - while (dtor.getNestedDeclarator() != null && !(dtor.getNestedDeclarator() instanceof IASTFunctionDeclarator)) { - dtor = dtor.getNestedDeclarator(); - } - IASTName n = dtor.getName(); + // Create parameter bindings only if the declarator declares a function + if (ASTQueries.findTypeRelevantDeclarator(fdtor) == fdtor) { + IASTName n = ASTQueries.findInnermostDeclarator(fdtor).getName(); IBinding temp = n.resolveBinding(); if (temp != null && temp instanceof CFunction) { binding = ((CFunction) temp).resolveParameter(name); |