mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 261417. Fix and test case.
This commit is contained in:
parent
b741929843
commit
d55331cf8e
2 changed files with 13 additions and 10 deletions
|
@ -2263,13 +2263,12 @@ public class AST2Tests extends AST2BaseTest {
|
|||
// void test(int a[]) {
|
||||
// func(&a);
|
||||
// }
|
||||
public void _testArrayPointer_261417() throws Exception {
|
||||
final boolean[] isCpps= {false, true};
|
||||
public void testArrayPointer_261417() throws Exception {
|
||||
String code= getAboveComment();
|
||||
for (boolean isCpp : isCpps) {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp);
|
||||
ba.assertNonProblem("func(&a)", 4, ICPPFunction.class);
|
||||
}
|
||||
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() {}
|
||||
|
|
|
@ -162,10 +162,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
|
||||
*/
|
||||
|
@ -186,12 +186,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();
|
||||
|
|
Loading…
Add table
Reference in a new issue