mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
type of new-expression, bug 264163.
This commit is contained in:
parent
91d6659911
commit
5a3544dc81
2 changed files with 10 additions and 0 deletions
|
@ -6713,6 +6713,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
// void blatest() {
|
||||
// reset(new tl());
|
||||
// reset(new cl());
|
||||
// reset(new cl[1]);
|
||||
// }
|
||||
public void testTypeOfNewExpression_264163() throws Exception {
|
||||
String code= getAboveComment();
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -19,6 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.dom.ast.IArrayType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
|
@ -210,6 +212,13 @@ public class CPPASTNewExpression extends ASTNode implements
|
|||
|
||||
public IType getExpressionType() {
|
||||
IType t= CPPVisitor.createType(getTypeId());
|
||||
if (t instanceof IArrayType) {
|
||||
try {
|
||||
t= ((IArrayType) t).getType();
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
}
|
||||
return new CPPPointerType(t);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue