Skip to content

Commit

Permalink
Disable enum-specific logic for generic parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
stakx committed Aug 28, 2023
1 parent d7f5b69 commit 18b514c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal abstract class OpCodeUtil
/// </summary>
public static void EmitLoadIndirectOpCodeForType(ILGenerator gen, Type type)
{
if (type.IsEnum)
if (type.IsEnum && !type.IsGenericParameter)
{
EmitLoadIndirectOpCodeForType(gen, GetUnderlyingTypeOfEnum(type));
return;
Expand Down Expand Up @@ -107,7 +107,7 @@ public static void EmitLoadOpCodeForDefaultValueOfType(ILGenerator gen, Type typ
/// </summary>
public static void EmitStoreIndirectOpCodeForType(ILGenerator gen, Type type)
{
if (type.IsEnum)
if (type.IsEnum && !type.IsGenericParameter)
{
EmitStoreIndirectOpCodeForType(gen, GetUnderlyingTypeOfEnum(type));
return;
Expand Down

0 comments on commit 18b514c

Please sign in to comment.