using System.Reflection;
using System;
+class GTest<T>
+{
+ public static volatile string str = "Hello";
+}
+
class Test
{
public volatile int field;
if (t [0] != typeof (System.Runtime.CompilerServices.IsVolatile))
return 3;
+
+ fi = typeof (GTest<>).GetField ("str");
+ if (fi.GetCustomAttributes (true).Length != 0)
+ return 10;
+ t = fi.GetRequiredCustomModifiers ();
+ if (t.Length != 1)
+ return 11;
+
+ if (t [0] != typeof (System.Runtime.CompilerServices.IsVolatile))
+ return 12;
+
Console.WriteLine ("OK");
return 0;
}
Assert (MyEnum.Value_2, e11.Compile ().Invoke ());
}
- void ConstantTest_12 ()
- {
- Expression<Func<MyEnum>> e12 = () => new MyEnum ();
- AssertNodeType (e12, ExpressionType.Constant);
- Assert<MyEnum> (0, e12.Compile ().Invoke ());
- }
-
void ConstantTest_13 ()
{
Expression<Func<int>> e13 = () => sizeof (byte);
AssertNodeType (e3, ExpressionType.MemberInit);
var r3 = e3.Compile ().Invoke (33);
Assert (33, r3.ShortProp);
+ }
+
+ void MemberInitTest_4 ()
+ {
+ Expression<Func<int>> e = () => new int { };
+
+ AssertNodeType (e, ExpressionType.MemberInit);
+ var r = e.Compile ().Invoke ();
+ Assert (0, r);
}
void ModuloTest ()
Assert (new { A = 9, Value = "a" }, e5.Compile ().Invoke ());
}
+ // CSC bug: emits new MyEnum as a constant
+ void NewTest_6 ()
+ {
+ Expression<Func<MyEnum>> e = () => new MyEnum ();
+ AssertNodeType (e, ExpressionType.New);
+ Assert<MyEnum> (0, e.Compile ().Invoke ());
+ }
+
void NotTest ()
{
Expression<Func<bool, bool>> e = (bool a) => !a;
<size>7</size>
</method>
<method name="Int32 Main()">
- <size>87</size>
+ <size>165</size>
+ </method>
+ </type>
+ <type name="GTest`1[T]">
+ <method name="Void .ctor()">
+ <size>7</size>
+ </method>
+ <method name="Void .cctor()">
+ <size>13</size>
</method>
</type>
</test>
<method name="Void ConstantTest_11()">
<size>59</size>
</method>
- <method name="Void ConstantTest_12()">
- <size>59</size>
- </method>
<method name="Void ConstantTest_13()">
<size>59</size>
</method>
<method name="Void AndTest_4()">
<size>92</size>
</method>
+ <method name="Void MemberInitTest_4()">
+ <size>66</size>
+ </method>
+ <method name="Void NewTest_6()">
+ <size>53</size>
+ </method>
</type>
</test>
<test name="gtest-etree-02.cs">