Merge pull request #4816 from BrzVlad/fix-remoting-exception
[mono.git] / mcs / tests / gtest-optional-04.cs
1 using System;
2
3 public struct S
4 {
5 }
6
7 public class C
8 {
9         static void Foo<T> (T t, T u = default (T))
10         {
11         }
12
13         static void TestParams (params int[] i)
14         {
15                 throw new ApplicationException ();
16         }
17
18         static void TestParams (int i = 4)
19         {
20         }
21
22         static void TestParams2 (string s, params int[] i)
23         {
24                 throw new ApplicationException ();
25         }
26
27         static void TestParams2 (string s, int i = 4)
28         {
29         }
30
31         static void TestStruct (int? s = new int ())
32         {
33                 if (!s.HasValue)
34                         throw new ApplicationException ("TestStruct");
35         }
36         
37         static void TestStruct2 (S? s = new S? ())
38         {
39         }
40         
41         public string this [int i, string s = "test"] {
42                 get { return s; }
43                 set { value = s; }
44         }
45
46         public static int Main ()
47         {
48                 Foo ("f");
49                 Foo (2);
50                 Foo (2, 4);
51                 Foo<long> (2);
52                 Foo<string> ("2", "3");
53                 
54                 TestParams ();
55                 TestParams2 ("a");
56                 
57                 TestStruct ();
58                 TestStruct2 ();
59                 
60                 C c = new C ();
61                 if (c [1] != "test")
62                         return 1;
63                 
64                 c [3] = "value";
65                 
66                 return 0;
67         }
68 }