mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 259680.
This commit is contained in:
parent
0e9935bd07
commit
6ea85657c4
2 changed files with 96 additions and 94 deletions
|
@ -6322,7 +6322,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
// void test(A& a) {
|
||||
// func(*a);
|
||||
// }
|
||||
public void _testSmartPointerReference_259680() throws Exception {
|
||||
public void testSmartPointerReference_259680() throws Exception {
|
||||
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
|
||||
ba.assertNonProblem("func(*a)", 4, ICPPFunction.class);
|
||||
}
|
||||
|
|
|
@ -1949,19 +1949,21 @@ public class CPPVisitor extends ASTQueries {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (op == IASTUnaryExpression.op_star && type instanceof ICPPClassType) {
|
||||
if (op == IASTUnaryExpression.op_star) {
|
||||
try {
|
||||
if (type instanceof ICPPReferenceType) {
|
||||
type = ((ICPPReferenceType) type).getType();
|
||||
}
|
||||
if (type instanceof ICPPClassType) {
|
||||
ICPPFunction operator= CPPSemantics.findOperator(expression, (ICPPClassType) type);
|
||||
if (operator != null) {
|
||||
return operator.getType().getReturnType();
|
||||
}
|
||||
} catch (DOMException de) {
|
||||
return de.getProblem();
|
||||
}
|
||||
}
|
||||
if (op == IASTUnaryExpression.op_star && (type instanceof IPointerType || type instanceof IArrayType)) {
|
||||
try {
|
||||
} else if (type instanceof IPointerType || type instanceof IArrayType) {
|
||||
return ((ITypeContainer) type).getType();
|
||||
}
|
||||
return new ProblemBinding(expression, IProblemBinding.SEMANTIC_INVALID_TYPE,
|
||||
("*" + type.toString()).toCharArray()); //$NON-NLS-1$
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
|
@ -2191,10 +2193,11 @@ public class CPPVisitor extends ASTQueries {
|
|||
}
|
||||
if (node != null) {
|
||||
IASTName name = null;
|
||||
if (node instanceof IASTDeclarator)
|
||||
if (node instanceof IASTDeclarator) {
|
||||
name = ((IASTDeclarator)node).getName();
|
||||
else if (node instanceof IASTName)
|
||||
} else if (node instanceof IASTName) {
|
||||
name = (IASTName) node;
|
||||
}
|
||||
if (name != null)
|
||||
found = new IASTName[] { name };
|
||||
}
|
||||
|
@ -2412,7 +2415,6 @@ public class CPPVisitor extends ASTQueries {
|
|||
while (!(node instanceof IASTDeclaration)) {
|
||||
if (node == null)
|
||||
return null;
|
||||
|
||||
node= node.getParent();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue