new error test
[mono.git] / mcs / tests / test-269.cs
1 using System;
2
3 class Class1
4 {
5         static int AddABunchOfInts (__arglist)
6         {
7                 int result = 0;
8
9                 System.ArgIterator iter = new System.ArgIterator (__arglist);
10                 int argCount = iter.GetRemainingCount();
11
12                 for (int i = 0; i < argCount; i++) {
13                         System.TypedReference typedRef = iter.GetNextArg();
14                         result += (int)TypedReference.ToObject( typedRef );
15                 }
16                 
17                 return result;
18         }
19
20         static int AddASecondBunchOfInts (int a, __arglist)
21         {
22                 int result = 0;
23
24                 System.ArgIterator iter = new System.ArgIterator (__arglist);
25                 int argCount = iter.GetRemainingCount();
26
27                 for (int i = 0; i < argCount; i++) {
28                         System.TypedReference typedRef = iter.GetNextArg();
29                         result += (int)TypedReference.ToObject( typedRef );
30                 }
31                 
32                 return result;
33         }
34
35         static int Main (string[] args)
36         {
37                 int result = AddABunchOfInts (__arglist ( 2, 3, 4 ));
38                 Console.WriteLine ("Answer: {0}", result);
39
40                 if (result != 9)
41                         return 1;
42
43                 result = AddASecondBunchOfInts (16, __arglist ( 2, 3, 4 ));
44                 Console.WriteLine ("Answer: {0}", result);
45
46                 if (result != 9)
47                         return 2;
48
49                 return 0;
50         }
51 }