Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/Mono.Linker.Tests.Cases')
-rw-r--r--test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs
index 3d47170d6..0b05ededc 100644
--- a/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs
+++ b/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs
@@ -9,6 +9,7 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.DataFlow
{
[SetupCompileArgument ("/langversion:7.3")]
+ [SetupCompileArgument ("/unsafe")]
[Kept]
[ExpectedNoWarnings]
class ByRefDataflow
@@ -31,6 +32,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow
PassRefToField ();
PassRefToParameter (null);
+
+ PointerDereference.Test ();
}
[Kept]
@@ -102,5 +105,32 @@ namespace Mono.Linker.Tests.Cases.DataFlow
public static void KeptMethod () { }
internal static void RemovedMethod () { }
}
+
+ [Kept]
+ unsafe class PointerDereference
+ {
+ [Kept]
+ [KeptAttributeAttribute (typeof (RequiresUnreferencedCodeAttribute))]
+ [RequiresUnreferencedCode ("")]
+ static unsafe void IntPtrDeref ()
+ {
+ *_ptr = GetDangerous ();
+ }
+
+ [Kept]
+ static IntPtr* _ptr;
+
+ [Kept]
+ [KeptAttributeAttribute (typeof (RequiresUnreferencedCodeAttribute))]
+ [RequiresUnreferencedCode ("")]
+ static IntPtr GetDangerous () { return IntPtr.Zero; }
+
+ [Kept]
+ [ExpectedWarning ("IL2026")]
+ public static void Test ()
+ {
+ IntPtrDeref ();
+ }
+ }
}
}