-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mono] Fix function pointer check (#80855)
* Fix function pointer check * Make is_monomorphic_array return false when the element is function pointer * Move test to a better location
- Loading branch information
1 parent
0ca3647
commit d6c2b43
Showing
4 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace TestFunctionPointer | ||
{ | ||
unsafe class TestThings | ||
{ | ||
public static delegate* managed<int>[][] Functions = { | ||
new delegate* managed<int>[] | ||
{ | ||
&Function, | ||
}, | ||
}; | ||
|
||
public static int Function() => 100; | ||
|
||
public static delegate* unmanaged<int>[][] Functions1 = { | ||
new delegate* unmanaged<int>[] | ||
{ | ||
&Function1, | ||
}, | ||
}; | ||
|
||
[UnmanagedCallersOnly] | ||
public static int Function1() => 100; | ||
|
||
public static delegate* managed<int, int>[][] Functions2 = { | ||
new delegate* managed<int, int>[] | ||
{ | ||
&Function2, | ||
}, | ||
}; | ||
|
||
public static int Function2(int a) { | ||
return a; | ||
} | ||
} | ||
|
||
unsafe class Program | ||
{ | ||
public static int Main() | ||
{ | ||
return TestThings.Functions2[0][0](TestThings.Functions[0][0]()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="Functionpointer.cs" /> | ||
</ItemGroup> | ||
</Project> |