[mcs] Pending implementation of accessors cannot hide base implementation with differ...
[mono.git] / mcs / tests / test-269.cs
1 using System;
2
3 struct Result {
4         public int res;
5         // big enough that it won't be returned in registers
6         double duh;
7         long bah;
8
9         public Result (int val) {
10                 res = val;
11                 bah = val;
12                 duh = val;
13         }
14 }
15
16 class Class1
17 {
18         static int AddABunchOfInts (__arglist)
19         {
20                 int result = 0;
21
22                 System.ArgIterator iter = new System.ArgIterator (__arglist);
23                 int argCount = iter.GetRemainingCount();
24
25                 for (int i = 0; i < argCount; i++) {
26                         System.TypedReference typedRef = iter.GetNextArg();
27                         result += (int)TypedReference.ToObject( typedRef );
28                 }
29                 
30                 return result;
31         }
32
33         static int AddASecondBunchOfInts (int a, __arglist)
34         {
35                 int result = 0;
36
37                 System.ArgIterator iter = new System.ArgIterator (__arglist);
38                 int argCount = iter.GetRemainingCount();
39
40                 for (int i = 0; i < argCount; i++) {
41                         System.TypedReference typedRef = iter.GetNextArg();
42                         result += (int)TypedReference.ToObject( typedRef );
43                 }
44                 
45                 return result;
46         }
47
48         static Result VtAddABunchOfInts (__arglist)
49         {
50                 int result = 0;
51
52                 System.ArgIterator iter = new System.ArgIterator (__arglist);
53                 int argCount = iter.GetRemainingCount();
54
55                 for (int i = 0; i < argCount; i++) {
56                         System.TypedReference typedRef = iter.GetNextArg();
57                         result += (int)TypedReference.ToObject( typedRef );
58                 }
59                 
60                 return new Result (result);
61         }
62
63         static Result VtAddASecondBunchOfInts (int a, __arglist)
64         {
65                 int result = 0;
66
67                 System.ArgIterator iter = new System.ArgIterator (__arglist);
68                 int argCount = iter.GetRemainingCount();
69
70                 for (int i = 0; i < argCount; i++) {
71                         System.TypedReference typedRef = iter.GetNextArg();
72                         result += (int)TypedReference.ToObject( typedRef );
73                 }
74                 
75                 return new Result (result);
76         }
77
78         int InstAddABunchOfInts (__arglist)
79         {
80                 int result = 0;
81
82                 System.ArgIterator iter = new System.ArgIterator (__arglist);
83                 int argCount = iter.GetRemainingCount();
84
85                 for (int i = 0; i < argCount; i++) {
86                         System.TypedReference typedRef = iter.GetNextArg();
87                         result += (int)TypedReference.ToObject( typedRef );
88                 }
89                 
90                 return result;
91         }
92
93         int InstAddASecondBunchOfInts (int a, __arglist)
94         {
95                 int result = 0;
96
97                 System.ArgIterator iter = new System.ArgIterator (__arglist);
98                 int argCount = iter.GetRemainingCount();
99
100                 for (int i = 0; i < argCount; i++) {
101                         System.TypedReference typedRef = iter.GetNextArg();
102                         result += (int)TypedReference.ToObject( typedRef );
103                 }
104                 
105                 return result;
106         }
107
108         Result InstVtAddABunchOfInts (__arglist)
109         {
110                 int result = 0;
111
112                 System.ArgIterator iter = new System.ArgIterator (__arglist);
113                 int argCount = iter.GetRemainingCount();
114
115                 for (int i = 0; i < argCount; i++) {
116                         System.TypedReference typedRef = iter.GetNextArg();
117                         result += (int)TypedReference.ToObject( typedRef );
118                 }
119                 
120                 return new Result (result);
121         }
122
123         Result InstVtAddASecondBunchOfInts (int a, __arglist)
124         {
125                 int result = 0;
126
127                 System.ArgIterator iter = new System.ArgIterator (__arglist);
128                 int argCount = iter.GetRemainingCount();
129
130                 for (int i = 0; i < argCount; i++) {
131                         System.TypedReference typedRef = iter.GetNextArg();
132                         result += (int)TypedReference.ToObject( typedRef );
133                 }
134                 
135                 return new Result (result);
136         }
137
138         public static int Main (string[] args)
139         {
140                 int result = AddABunchOfInts (__arglist ( 2, 3, 4 ));
141                 Console.WriteLine ("Answer: {0}", result);
142
143                 if (result != 9)
144                         return 1;
145
146                 result = AddASecondBunchOfInts (16, __arglist ( 2, 3, 4 ));
147                 Console.WriteLine ("Answer: {0}", result);
148
149                 if (result != 9)
150                         return 2;
151
152                 Class1 s = new Class1 ();
153
154                 result = s.InstAddABunchOfInts (__arglist ( 2, 3, 4, 5 ));
155                 Console.WriteLine ("Answer: {0}", result);
156
157                 if (result != 14)
158                         return 3;
159
160                 result = s.InstAddASecondBunchOfInts (16, __arglist ( 2, 3, 4, 5, 6 ));
161                 Console.WriteLine ("Answer: {0}", result);
162
163                 if (result != 20)
164                         return 4;
165
166                 result = s.InstVtAddABunchOfInts (__arglist ( 2, 3, 4, 5 )).res;
167                 Console.WriteLine ("Answer: {0}", result);
168
169                 if (result != 14)
170                         return 5;
171
172                 result = s.InstVtAddASecondBunchOfInts (16, __arglist ( 2, 3, 4, 5, 6 )).res;
173                 Console.WriteLine ("Answer: {0}", result);
174
175                 if (result != 20)
176                         return 6;
177
178                 result = VtAddABunchOfInts (__arglist ( 2, 3, 4, 5, 1 )).res;
179                 Console.WriteLine ("Answer: {0}", result);
180
181                 if (result != 15)
182                         return 7;
183
184                 result = VtAddASecondBunchOfInts (16, __arglist ( 2, 3, 4, 5, 6, 1 )).res;
185                 Console.WriteLine ("Answer: {0}", result);
186
187                 if (result != 21)
188                         return 8;
189
190                 result = s.InstAddABunchOfInts (__arglist ( ));
191                 if (result != 0)
192                         return 9;
193                 
194                 return 0;
195         }
196 }