diff --git a/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.VoidPtrInterop_architecture=Dynamic.verified.txt b/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.VoidPtrInterop_architecture=Dynamic.verified.txt index c57a332d..38931ba8 100644 --- a/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.VoidPtrInterop_architecture=Dynamic.verified.txt +++ b/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.VoidPtrInterop_architecture=Dynamic.verified.txt @@ -7,9 +7,10 @@ IL_0000: ldc.i4.0 IL_0001: stloc.0 IL_0002: ldloca.s V_0 - IL_0004: call Cesium.Runtime.VoidPtr Cesium.Runtime.VoidPtr::op_Implicit(System.Void*) - IL_0009: call System.Int32 Test::Func(Cesium.Runtime.VoidPtr) - IL_000e: ret + IL_0004: conv.i + IL_0005: call Cesium.Runtime.VoidPtr Cesium.Runtime.VoidPtr::op_Implicit(System.Void*) + IL_000a: call System.Int32 Test::Func(Cesium.Runtime.VoidPtr) + IL_000f: ret System.Int32 ::() Locals: diff --git a/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.VoidPtrInterop_architecture=Wide.verified.txt b/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.VoidPtrInterop_architecture=Wide.verified.txt index c57a332d..38931ba8 100644 --- a/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.VoidPtrInterop_architecture=Wide.verified.txt +++ b/Cesium.CodeGen.Tests/verified/CodeGenNetInteropTests.VoidPtrInterop_architecture=Wide.verified.txt @@ -7,9 +7,10 @@ IL_0000: ldc.i4.0 IL_0001: stloc.0 IL_0002: ldloca.s V_0 - IL_0004: call Cesium.Runtime.VoidPtr Cesium.Runtime.VoidPtr::op_Implicit(System.Void*) - IL_0009: call System.Int32 Test::Func(Cesium.Runtime.VoidPtr) - IL_000e: ret + IL_0004: conv.i + IL_0005: call Cesium.Runtime.VoidPtr Cesium.Runtime.VoidPtr::op_Implicit(System.Void*) + IL_000a: call System.Int32 Test::Func(Cesium.Runtime.VoidPtr) + IL_000f: ret System.Int32 ::() Locals: diff --git a/Cesium.CodeGen/Ir/Expressions/TypeCastExpression.cs b/Cesium.CodeGen/Ir/Expressions/TypeCastExpression.cs index 0c3ddbf0..2d9bbca6 100644 --- a/Cesium.CodeGen/Ir/Expressions/TypeCastExpression.cs +++ b/Cesium.CodeGen/Ir/Expressions/TypeCastExpression.cs @@ -60,6 +60,7 @@ public void EmitTo(IEmitScope scope) { if (iType.UnderlyingType.FullName == TypeSystemEx.VoidPtrFullTypeName) { + Add(OpCodes.Conv_I); // TODO: Should only emit if required. scope.Method.Body.Instructions.Add( Instruction.Create(OpCodes.Call, iType.GetConvertCall(scope.AssemblyContext))); }