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

test-212.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 95bf0d0ea5b22bd8945e2ba8e1b8e26e51425b5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//
// A compilation test - params with implicit user conversion
//

class Problem {
        string somedata;

        public Problem(string somedata) {
                this.somedata = somedata;
        }
        public static implicit operator Problem(int x) {
                return new Problem("" + x);
        }

        public static int Multi(int first, params Problem[] rest) {
                return rest.Length;
        }

        public static int Main(string[] args) {
                Problem[] ps = new Problem[] { 1, 2, 3 }; // ok
                Multi (1, 2, 3, 4); // fails to compile

                return 0;
        }
}