// (C) 2001 Ximian, Inc. http://www.ximian.com
//
+#if !FULL_AOT_RUNTIME
using System;
using System.Reflection;
using System.Reflection.Emit;
{
if (position > 0) {
Type t = methodb.GetParameterType (position - 1);
- if (defaultValue != null && t != defaultValue.GetType ())
- throw new ArgumentException ("Constant does not match the defined type.");
+ if (defaultValue != null && t != defaultValue.GetType ()) {
+ if(!t.IsEnum || t.UnderlyingSystemType != defaultValue.GetType ())
+ throw new ArgumentException ("Constant does not match the defined type.");
+ }
if (t.IsValueType && !t.IsPrimitive && !t.IsEnum && t != typeof (DateTime))
throw new ArgumentException ("" + t + " is not a supported constant type.");
}
}
}
+#endif