X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fcodegen.cs;h=d5ba75c12813af9d07e4b3182134f82cc3e557f9;hb=b078895e893c2896b1dbdff3fac055aa2f7f2b1f;hp=1dfb747ba6a46f96ebff889b48259408c371f46a;hpb=c1d81649cc1d16ee47bd6fb951e220d8aba6a1d0;p=mono.git diff --git a/mcs/mcs/codegen.cs b/mcs/mcs/codegen.cs index 1dfb747ba6a..d5ba75c1281 100644 --- a/mcs/mcs/codegen.cs +++ b/mcs/mcs/codegen.cs @@ -1263,10 +1263,15 @@ namespace Mono.CSharp if (conditionalAccess) { if (!ec.ConditionalAccess.Statement) { - if (ec.ConditionalAccess.Type.IsNullableType) - Nullable.LiftedNull.Create (ec.ConditionalAccess.Type, Location.Null).Emit (ec); - else + var t = ec.ConditionalAccess.Type; + if (t.IsNullableType) + Nullable.LiftedNull.Create (t, Location.Null).Emit (ec); + else { ec.EmitNull (); + + if (t.IsGenericParameter) + ec.Emit (OpCodes.Unbox_Any, t); + } } ec.Emit (OpCodes.Br, ec.ConditionalAccess.EndLabel);