@@ -1071,6 +1071,7 @@ bool InitThisField(InterpState &S, CodePtr OpPC, uint32_t I) {
1071
1071
1072
1072
template <PrimType Name, class T = typename PrimConv<Name>::T>
1073
1073
bool InitThisBitField (InterpState &S, CodePtr OpPC, const Record::Field *F) {
1074
+ assert (F->isBitField ());
1074
1075
if (S.checkingPotentialConstantExpression ())
1075
1076
return false ;
1076
1077
const Pointer &This = S.Current ->getThis ();
@@ -1112,8 +1113,9 @@ bool InitField(InterpState &S, CodePtr OpPC, uint32_t I) {
1112
1113
1113
1114
template <PrimType Name, class T = typename PrimConv<Name>::T>
1114
1115
bool InitBitField (InterpState &S, CodePtr OpPC, const Record::Field *F) {
1116
+ assert (F->isBitField ());
1115
1117
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 );
1117
1119
Field.deref <T>() = Value.truncate (F->Decl ->getBitWidthValue (S.getCtx ()));
1118
1120
Field.activate ();
1119
1121
Field.initialize ();
@@ -1334,11 +1336,10 @@ bool StoreBitField(InterpState &S, CodePtr OpPC) {
1334
1336
return false ;
1335
1337
if (!Ptr .isRoot ())
1336
1338
Ptr .initialize ();
1337
- if (auto *FD = Ptr .getField ()) {
1339
+ if (const auto *FD = Ptr .getField ())
1338
1340
Ptr .deref <T>() = Value.truncate (FD->getBitWidthValue (S.getCtx ()));
1339
- } else {
1341
+ else
1340
1342
Ptr .deref <T>() = Value;
1341
- }
1342
1343
return true ;
1343
1344
}
1344
1345
@@ -1350,11 +1351,10 @@ bool StoreBitFieldPop(InterpState &S, CodePtr OpPC) {
1350
1351
return false ;
1351
1352
if (!Ptr .isRoot ())
1352
1353
Ptr .initialize ();
1353
- if (auto *FD = Ptr .getField ()) {
1354
+ if (const auto *FD = Ptr .getField ())
1354
1355
Ptr .deref <T>() = Value.truncate (FD->getBitWidthValue (S.getCtx ()));
1355
- } else {
1356
+ else
1356
1357
Ptr .deref <T>() = Value;
1357
- }
1358
1358
return true ;
1359
1359
}
1360
1360
0 commit comments