X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fliteral.cs;h=c7aae9204b0a775c51648643e8ade9d926fb42ca;hb=67597881bd4731b3f1c848fc9f8f13e63e7d2c0f;hp=6d3a4ceeac0c7a19c6e910c9e912c7bea0df4326;hpb=7df9555b2ec7cfabb956e5c04a62303f7a592d14;p=mono.git diff --git a/mcs/mcs/literal.cs b/mcs/mcs/literal.cs index 6d3a4ceeac0..c7aae9204b0 100644 --- a/mcs/mcs/literal.cs +++ b/mcs/mcs/literal.cs @@ -100,7 +100,7 @@ namespace Mono.CSharp { return "null"; } - public override void Error_ValueCannotBeConverted (Location loc, Type t) + public override void Error_ValueCannotBeConverted (Location loc, Type t, bool expl) { Report.Error (37, loc, "Cannot convert null to `{0}' because it is a value type", TypeManager.CSharpName (t)); @@ -114,6 +114,13 @@ namespace Mono.CSharp { return base.ToType (type, loc); } + public override Constant Reduce(EmitContext ec, Type target_type) + { + if (!TypeManager.IsValueType (target_type)) + return new NullCast (this, target_type); + + return null; + } } //