|
|
@@ -95,9 +95,10 @@ namespace System.Reflection.Emit {
|
|
|
{
|
|
|
if (position > 0) {
|
|
|
Type t = methodb.GetParameterType (position - 1);
|
|
|
- if (defaultValue != null && t != defaultValue.GetType ())
|
|
|
+ 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.");
|
|
|
}
|