diff --git a/Tests/LLVMSharp.UnitTests/Functions.cs b/Tests/LLVMSharp.UnitTests/Functions.cs new file mode 100644 index 00000000..630268a6 --- /dev/null +++ b/Tests/LLVMSharp.UnitTests/Functions.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information. + +using LLVMSharp.Interop; +using NUnit.Framework; + +namespace LLVMSharp.UnitTests +{ + public class Functions + { + [Test] + public void ParamTypesRoundtrip() + { + var returnType = LLVMTypeRef.Int8; + var parameterTypes = new[] { LLVMTypeRef.Double }; + var functionType = LLVMTypeRef.CreateFunction(returnType, parameterTypes); + Assert.AreEqual(parameterTypes, functionType.ParamTypes); + } + } +} diff --git a/sources/LLVMSharp/Interop.Extensions/LLVMTypeRef.cs b/sources/LLVMSharp/Interop.Extensions/LLVMTypeRef.cs index d9be1f18..3608e0ae 100644 --- a/sources/LLVMSharp/Interop.Extensions/LLVMTypeRef.cs +++ b/sources/LLVMSharp/Interop.Extensions/LLVMTypeRef.cs @@ -84,7 +84,7 @@ public LLVMTypeRef[] ParamTypes fixed (LLVMTypeRef* pDest = Dest) { - LLVM.GetParamTypes(this, (LLVMOpaqueType**)&pDest); + LLVM.GetParamTypes(this, (LLVMOpaqueType**)pDest); } return Dest; @@ -112,7 +112,7 @@ public LLVMTypeRef[] StructElementTypes fixed (LLVMTypeRef* pDest = Dest) { - LLVM.GetStructElementTypes(this, (LLVMOpaqueType**)&pDest); + LLVM.GetStructElementTypes(this, (LLVMOpaqueType**)pDest); } return Dest; @@ -155,7 +155,7 @@ public LLVMTypeRef[] Subtypes fixed (LLVMTypeRef* pArr = Arr) { - LLVM.GetSubtypes(this, (LLVMOpaqueType**)&pArr); + LLVM.GetSubtypes(this, (LLVMOpaqueType**)pArr); } return Arr;