Skip to content

Commit

Permalink
Disallow statics of spans and class instance members of span
Browse files Browse the repository at this point in the history
Functional fix for #8516 to cover some additional cases. IL tests will be coming later in a separate PR.
  • Loading branch information
kouvel committed Jan 23, 2017
1 parent 62ac5f0 commit 7268132
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/vm/methodtablebuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1864,6 +1864,11 @@ MethodTableBuilder::BuildMethodTableThrowing(

if (bmtFP->fIsByRefLikeType)
{
if (!IsValueClass())
{
// Non-value-classes cannot contain by-ref-like instance fields
COMPlusThrowHR(COR_E_TYPELOAD);
}
pMT->SetIsByRefLike();
}

Expand Down Expand Up @@ -4222,6 +4227,11 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList,
// Inherit IsByRefLike characteristic from fields
if (!IsSelfRef(pByValueClass) && pByValueClass->IsByRefLike())
{
if (fIsStatic)
{
// By-ref-like types cannot be used for static fields
COMPlusThrowHR(COR_E_TYPELOAD);
}
bmtFP->fIsByRefLikeType = true;
}

Expand Down

0 comments on commit 7268132

Please sign in to comment.