Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-primary-ctor-07.cs
1 // Compiler options: -langversion:experimental
2
3 using System;
4
5 struct S (int x)
6 {
7         public int y = x;
8
9         public S (char x)
10                 : this (1)
11         {
12         }
13
14         static S ()
15         {
16         }
17 }
18
19 struct S2 (int arg)
20 {
21         public readonly int v = arg;
22 }
23
24 struct S3 (string s = "arg")
25 {
26         public readonly string V2 = s;
27
28         public S3 (int i, string s = "arg2")
29                 : this (s)
30         {
31         }
32 }
33
34 class X
35 {
36         public static int Main ()
37         {
38                 if (new S (-5).y != -5)
39                         return 1;
40
41                 if (new S ('x').y != 1)
42                         return 2;
43
44                 if (new S2 (2).v != 2)
45                         return 3;
46
47                 if (new S3 ("x").V2 != "x")
48                         return 4;
49
50                 if (new S3 (0).V2 != "arg2")
51                         return 5;
52
53                 return 0;
54         }
55 }