diff options
author | Sergey Prigogin | 2009-01-19 00:48:13 +0000 |
---|---|---|
committer | Sergey Prigogin | 2009-01-19 00:48:13 +0000 |
commit | 9d17c56537916eb6d61e06616ffa0004eca305a2 (patch) | |
tree | bc6fa4a23bc749ad825dd01ab9a3c9b327db3aab /core | |
parent | 6494e815f58208c0548c76c9f8d75ed4ccabe3a6 (diff) | |
download | org.eclipse.cdt-9d17c56537916eb6d61e06616ffa0004eca305a2.tar.gz org.eclipse.cdt-9d17c56537916eb6d61e06616ffa0004eca305a2.tar.xz org.eclipse.cdt-9d17c56537916eb6d61e06616ffa0004eca305a2.zip |
Bug 261417. Fix and test case.
Diffstat (limited to 'core')
2 files changed, 23 insertions, 5 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 c94159e2369..b537779b896 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 @@ -2132,7 +2132,20 @@ public class AST2Tests extends AST2BaseTest { assertEquals(decls.length, 1); assertEquals(decls[0], name_parm); } - + + // void func(int** p); + // + // void test(int a[]) { + // func(&a); + // } + public void testArrayPointer_261417() throws Exception { + String code= getAboveComment(); + BindingAssertionHelper baC= new BindingAssertionHelper(code, false); + baC.assertNonProblem("func(&a)", 4, IFunction.class); + BindingAssertionHelper baCpp= new BindingAssertionHelper(code, true); + baCpp.assertNonProblem("func(&a)", 4, ICPPFunction.class); + } + // int f() {} // int *f2() {} // int (* f3())() {} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java index 9c70b32be6f..9e16e9a0fee 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics; import org.eclipse.cdt.core.dom.ast.DOMException; +import org.eclipse.cdt.core.dom.ast.IArrayType; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IFunctionType; import org.eclipse.cdt.core.dom.ast.IPointerType; @@ -156,10 +157,10 @@ public class SemanticUtil { } /** - * Descends into type containers, stopping at pointer-to-member types if - * specified. + * Descends into type containers, stopping at pointer-to-member types if specified. * @param type the root type - * @param lastPointerType if non-null, the deepest pointer type encounter is stored in element zero + * @param lastPointerType if non-null, the deepest pointer or array type encountered + * is stored in element zero. * @param stopAtPointerToMember if true, do not descend into ICPPPointerToMember types * @return the deepest type in a type container sequence */ @@ -180,12 +181,16 @@ public class SemanticUtil { lastPointerType[0]= type; } type= ((IPointerType) type).getType(); + } else if (type instanceof IArrayType) { + if (lastPointerType != null) { + lastPointerType[0]= type; + } + type= ((IArrayType) type).getType(); } else if (type instanceof ICPPReferenceType) { type= ((ICPPReferenceType) type).getType(); } else { return type; } - } } catch (DOMException e) { return e.getProblem(); |