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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@hurrynot.org>2004-10-05 15:33:05 +0400
committerRaja R Harinath <harinath@hurrynot.org>2004-10-05 15:33:05 +0400
commit62f2bd39d9931d45fe61f6a1f22337b0eb524f13 (patch)
treead46892af33359f6786f474857016a1f28c58f41 /mcs/tests/test-305.cs
parentfca6d5f5bc287af303a2dc254bcdb003eca8320e (diff)
New testcases for type-resolution.
svn path=/trunk/mcs/; revision=34716
Diffstat (limited to 'mcs/tests/test-305.cs')
-rw-r--r--mcs/tests/test-305.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/mcs/tests/test-305.cs b/mcs/tests/test-305.cs
new file mode 100644
index 00000000000..7fd7fc11d63
--- /dev/null
+++ b/mcs/tests/test-305.cs
@@ -0,0 +1,49 @@
+// Compiler options: -unsafe
+
+using System;
+using System.Runtime.InteropServices;
+
+using S = A.T;
+
+class A
+{
+ [StructLayout (LayoutKind.Sequential)]
+ struct T { int x; }
+
+ public class B
+ {
+ [StructLayout (LayoutKind.Sequential)]
+ struct S { int x; int y; }
+ S s;
+
+ public B () {
+ string error = "";
+
+ unsafe {
+ if (typeof (S *).GetElementType () != typeof (A.B.S))
+ error += " composed cast (pointer),";
+
+ if (sizeof (S) != sizeof (A.B.S))
+ error += " sizeof,";
+
+ S *p1 = stackalloc S [1];
+
+ if ((*p1).GetType () != typeof (A.B.S))
+ error += " local declaration, 'stackalloc' keyword,";
+
+ fixed (S *p2 = &s) {
+ if ((*p2).GetType () != typeof (A.B.S))
+ error += " class declaration, 'fixed' statement,";
+ }
+ }
+
+ if (error.Length != 0)
+ throw new Exception ("The following couldn't resolve S as A+B+S:" + error);
+ }
+ }
+
+ public static void Main()
+ {
+ object o = new A.B();
+ }
+}