@@ -1071,6 +1071,7 @@ bool InitThisField(InterpState &S, CodePtr OpPC, uint32_t I) {
10711071
10721072template <PrimType Name, class T = typename PrimConv<Name>::T>
10731073bool InitThisBitField (InterpState &S, CodePtr OpPC, const Record::Field *F) {
1074+ assert (F->isBitField ());
10741075 if (S.checkingPotentialConstantExpression ())
10751076 return false ;
10761077 const Pointer &This = S.Current ->getThis ();
@@ -1112,8 +1113,9 @@ bool InitField(InterpState &S, CodePtr OpPC, uint32_t I) {
11121113
11131114template <PrimType Name, class T = typename PrimConv<Name>::T>
11141115bool InitBitField (InterpState &S, CodePtr OpPC, const Record::Field *F) {
1116+ assert (F->isBitField ());
11151117 const T &Value = S.Stk .pop <T>();
1116- const Pointer &Field = S.Stk .pop <Pointer>().atField (F->Offset );
1118+ const Pointer &Field = S.Stk .peek <Pointer>().atField (F->Offset );
11171119 Field.deref <T>() = Value.truncate (F->Decl ->getBitWidthValue (S.getCtx ()));
11181120 Field.activate ();
11191121 Field.initialize ();
@@ -1334,11 +1336,10 @@ bool StoreBitField(InterpState &S, CodePtr OpPC) {
13341336 return false ;
13351337 if (!Ptr.isRoot ())
13361338 Ptr.initialize ();
1337- if (auto *FD = Ptr.getField ()) {
1339+ if (const auto *FD = Ptr.getField ())
13381340 Ptr.deref <T>() = Value.truncate (FD->getBitWidthValue (S.getCtx ()));
1339- } else {
1341+ else
13401342 Ptr.deref <T>() = Value;
1341- }
13421343 return true ;
13431344}
13441345
@@ -1350,11 +1351,10 @@ bool StoreBitFieldPop(InterpState &S, CodePtr OpPC) {
13501351 return false ;
13511352 if (!Ptr.isRoot ())
13521353 Ptr.initialize ();
1353- if (auto *FD = Ptr.getField ()) {
1354+ if (const auto *FD = Ptr.getField ())
13541355 Ptr.deref <T>() = Value.truncate (FD->getBitWidthValue (S.getCtx ()));
1355- } else {
1356+ else
13561357 Ptr.deref <T>() = Value;
1357- }
13581358 return true ;
13591359}
13601360
0 commit comments