diff options
author | Martin Baulig <martin@novell.com> | 2002-08-11 23:34:29 +0400 |
---|---|---|
committer | Martin Baulig <martin@novell.com> | 2002-08-11 23:34:29 +0400 |
commit | 625275d351ae5722d0f9a2698315104e980b51a1 (patch) | |
tree | 6acdad26b6ea736602a82f43e2db725da60d3329 /mcs/tests/test-162.cs | |
parent | f7c08d45f1bc3f56bc6f836d5ca017246e2a2ae0 (diff) |
2002-08-11 Martin Baulig <martin@gnome.org>
* test-162.cs: New test.
svn path=/trunk/mcs/; revision=6585
Diffstat (limited to 'mcs/tests/test-162.cs')
-rw-r--r-- | mcs/tests/test-162.cs | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/mcs/tests/test-162.cs b/mcs/tests/test-162.cs new file mode 100644 index 00000000000..284a423d0fb --- /dev/null +++ b/mcs/tests/test-162.cs @@ -0,0 +1,91 @@ +using System; + +struct A +{ + public int a; + private long b; + private float c; + + public A (int foo) + { + a = foo; + b = 8; + c = 9.0F; + } +} + +struct B +{ + public int a; +} + +struct C +{ + public long b; + + public C (long foo) + { + b = foo; + } + + // has `this' initializer, no need to initialize fields. + public C (string foo) + : this (500) + { } +} + +class X +{ + static void test_output (A x) + { + } + + static void test_output (B y) + { + } + + static void test1 () + { + A x; + + x.a = 5; + Console.WriteLine (x.a); + } + + static void test2 () + { + B y; + + y.a = 5; + Console.WriteLine (y.a); + Console.WriteLine (y); + } + + static void test3 () + { + A x = new A (85); + + Console.WriteLine (x); + } + + static void test4 (A x) + { + x.a = 5; + } + + static void test5 (out A x) + { + x = new A (85); + } + + static void test6 (out B y) + { + y.a = 1; + } + + public static int Main () + { + // Compilation-only test. + return 0; + } +} |