public Constant Reduce (ResolveContext ec, TypeSpec target_type)
{
try {
return TryReduceConstant (ec, target_type);
} catch (OverflowException) {
if (ec.ConstantCheckState && Type.BuiltinType != BuiltinTypeSpec.Type.Decimal) {
ec.Report.Error (221, loc,
"Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax to override)",
GetValueAsLiteral (), target_type.GetSignatureForError ());
} else {
Error_ValueCannotBeConverted (ec, target_type, false);
}
return New.Constantify (target_type, loc);
}
}