Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / gtest-optional-17.cs
1 using System;
2 using System.Reflection;
3 using System.Runtime.InteropServices;
4
5 struct BI
6 {
7         public static implicit operator BI (int i)
8         {
9                 return new BI ();
10         }
11 }
12
13 class C
14 {
15         public static void M ([DefaultParameterValue (1 + 3)]BI step)
16         {
17         }
18         
19         public static void M2 ([DefaultParameterValue (1)] object o)
20         {
21         }
22
23         public static int Main ()
24         {
25                 var m = typeof (C).GetMethod ("M");
26                 var p = m.GetParameters ()[0];
27
28                 Console.WriteLine (p.Attributes);
29                 if (p.Attributes != ParameterAttributes.HasDefault)
30                         return 2;
31
32                 if ((int) p.DefaultValue != 4)
33                         return 1;
34
35                 Console.WriteLine (p.DefaultValue);
36                 return 0;
37         }
38 }