diff --git a/mcs/class/corlib/System/Delegate.cs b/mcs/class/corlib/System/Delegate.cs index 958b70ce816eb373f9f96c1bee29c513284f99d6..7447b4a9e0190ae6b50b4e146549904a50d1fcb2 100644 --- a/mcs/class/corlib/System/Delegate.cs +++ b/mcs/class/corlib/System/Delegate.cs @@ -158,6 +158,17 @@ namespace System // Delegate covariance if (!returnType.IsValueType && delReturnType.IsAssignableFrom (returnType)) returnMatch = true; + else + { + bool isDelArgEnum = delReturnType.IsEnum; + bool isArgEnum = returnType.IsEnum; + if (isArgEnum && isDelArgEnum) + returnMatch = Enum.GetUnderlyingType(delReturnType) == Enum.GetUnderlyingType(returnType); + else if (isDelArgEnum && Enum.GetUnderlyingType(delReturnType) == returnType) + returnMatch = true; + else if (isArgEnum && Enum.GetUnderlyingType(returnType) == delReturnType) + returnMatch = true; + } } return returnMatch;