Skip to content

Commit 946b6c4

Browse files
Fix variance safety check (#19)
1 parent b4e1882 commit 946b6c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/coreclr/vm/methodtablebuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,8 +3035,8 @@ MethodTableBuilder::EnumerateClassMethods()
30353035

30363036
// Check the appearance of covariant and contravariant in the method signature
30373037
// Note that variance is only supported for interfaces, and these rules are not
3038-
// checked for static methods as they cannot be called variantly.
3039-
if ((bmtGenerics->pVarianceInfo != NULL) && !IsMdStatic(dwMemberAttrs))
3038+
// checked for non-virtual static methods as they cannot be called variantly.
3039+
if ((bmtGenerics->pVarianceInfo != NULL) && (IsMdVirtual(dwMemberAttrs) || !IsMdStatic(dwMemberAttrs)))
30403040
{
30413041
SigPointer sp(pMemberSignature, cMemberSignature);
30423042
uint32_t callConv;

0 commit comments

Comments
 (0)