@@ -37,7 +37,6 @@ import dmd.dsymbol;
3737import dmd.dtemplate;
3838import dmd.errors;
3939import dmd.expression;
40- import dmd.id;
4140import dmd.expressionsem : toBool, toInteger;
4241import dmd.func;
4342import dmd.globals;
@@ -782,11 +781,6 @@ private void membersToDt(AggregateDeclaration ad, ref DtBuilder dtb,
782781 size_t index = 0 ;
783782 for (ClassDeclaration c = cdb.baseClass; c; c = c.baseClass)
784783 index += c.fields.length;
785- // CTFE elements exclude __monitor (emitted separately).
786- // Subtract it from the index, but only when Object is actually
787- // in the base hierarchy (index > 0 means cdb is not itself Object).
788- if (index > 0 )
789- index -= cdb.hasMonitor();
790784 membersToDt(cdb, dtb, elements, index, concreteType, null );
791785 offset = cdb.structsize;
792786 }
@@ -851,12 +845,9 @@ private void membersToDt(AggregateDeclaration ad, ref DtBuilder dtb,
851845 offset = 0 ;
852846 // `offset` now is where the fields start
853847
854- // __monitor is emitted separately (not from CTFE elements), so exclude it from the count.
855- // This applies to Object itself (the root class with no base class), not to interfaces.
856- const size_t monitorExcluded = (cd && ! cd.isInterfaceDeclaration() && ! cd.baseClass && cd.hasMonitor()) ? 1 : 0 ;
857848 assert (! elements ||
858849 firstFieldIndex <= elements.length &&
859- firstFieldIndex + ad.fields.length - monitorExcluded <= elements.length);
850+ firstFieldIndex + ad.fields.length <= elements.length);
860851
861852 uint bitByteOffset = 0 ; // byte offset of bit field
862853 uint bitOffset = 0 ; // starting bit number
@@ -909,10 +900,6 @@ private void membersToDt(AggregateDeclaration ad, ref DtBuilder dtb,
909900
910901 foreach (i, field; ad.fields)
911902 {
912- // __monitor is emitted separately (not from CTFE elements), skip it here
913- if (field.ident == Id.__monitor)
914- continue ;
915-
916903 // skip if no element for this field
917904 if (elements && ! (* elements)[firstFieldIndex + i])
918905 continue ;
@@ -1179,9 +1166,6 @@ void ClassReferenceExp_toInstanceDt(ClassReferenceExp ce, ref DtBuilder dtb)
11791166 size_t firstFieldIndex = 0 ;
11801167 for (ClassDeclaration c = cd.baseClass; c; c = c.baseClass)
11811168 firstFieldIndex += c.fields.length;
1182- // CTFE elements exclude __monitor (it is emitted separately by membersToDt),
1183- // so adjust the index to match the elements array layout.
1184- firstFieldIndex -= cd.hasMonitor();
11851169 membersToDt(cd, dtb, ce.value.elements, firstFieldIndex, cd, null );
11861170}
11871171
0 commit comments