1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Added protection against ClassCastException

Change-Id: Ib14420d944c840ebda24305530f82142998cfe5c
This commit is contained in:
Sergey Prigogin 2016-10-10 18:14:13 -07:00 committed by Gerrit Code Review @ Eclipse.org
parent 52eb5f7b02
commit 662091c72d

View file

@ -88,8 +88,13 @@ public final class ExecDeclarator implements ICPPExecution {
} else if (isPointerType(nestedType) && !isCStringType(nestedType)) {
return createPointerValue(record, context, computedInitializerEval);
} else if (isArrayType(nestedType) && !isCStringType(nestedType)) {
IValue value = CompositeValue.create((EvalInitList) computedInitializerEval,(IArrayType) (type));
return new EvalFixed(type, computedInitializerEval.getValueCategory(context.getPoint()), value);
if (computedInitializerEval instanceof EvalInitList) {
IValue value = CompositeValue.create((EvalInitList) computedInitializerEval, (IArrayType) (type));
return new EvalFixed(type, computedInitializerEval.getValueCategory(context.getPoint()), value);
} else {
// TODO(sprigogin): Should something else be done here?
return EvalFixed.INCOMPLETE;
}
} else if (isValueInitialization(computedInitializerEval)) {
ICPPEvaluation defaultValue = new EvalTypeId(type, context.getPoint(), false, new ICPPEvaluation[]{});
return new EvalFixed(type, defaultValue.getValueCategory(context.getPoint()), defaultValue.getValue(context.getPoint()));