mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
Added protection against ClassCastException
Change-Id: Ib14420d944c840ebda24305530f82142998cfe5c
This commit is contained in:
parent
52eb5f7b02
commit
662091c72d
1 changed files with 7 additions and 2 deletions
|
@ -88,8 +88,13 @@ public final class ExecDeclarator implements ICPPExecution {
|
||||||
} else if (isPointerType(nestedType) && !isCStringType(nestedType)) {
|
} else if (isPointerType(nestedType) && !isCStringType(nestedType)) {
|
||||||
return createPointerValue(record, context, computedInitializerEval);
|
return createPointerValue(record, context, computedInitializerEval);
|
||||||
} else if (isArrayType(nestedType) && !isCStringType(nestedType)) {
|
} else if (isArrayType(nestedType) && !isCStringType(nestedType)) {
|
||||||
|
if (computedInitializerEval instanceof EvalInitList) {
|
||||||
IValue value = CompositeValue.create((EvalInitList) computedInitializerEval, (IArrayType) (type));
|
IValue value = CompositeValue.create((EvalInitList) computedInitializerEval, (IArrayType) (type));
|
||||||
return new EvalFixed(type, computedInitializerEval.getValueCategory(context.getPoint()), value);
|
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)) {
|
} else if (isValueInitialization(computedInitializerEval)) {
|
||||||
ICPPEvaluation defaultValue = new EvalTypeId(type, context.getPoint(), false, new ICPPEvaluation[]{});
|
ICPPEvaluation defaultValue = new EvalTypeId(type, context.getPoint(), false, new ICPPEvaluation[]{});
|
||||||
return new EvalFixed(type, defaultValue.getValueCategory(context.getPoint()), defaultValue.getValue(context.getPoint()));
|
return new EvalFixed(type, defaultValue.getValueCategory(context.getPoint()), defaultValue.getValue(context.getPoint()));
|
||||||
|
|
Loading…
Add table
Reference in a new issue